Part Number Hot Search : 
BDW83A 00104 Z5232 71308 TFS1220 OS1043 15ARU C5001
Product Description
Full Text Search
 

To Download ADUC7039BCP6Z Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  integrated, precision battery sensor for automotive systems aduc7039 rev. b information furnished by analog devices is believed to be accurate and reliable. however, no responsibility is assumed by analog devices for its use, nor for any infringements of patents or other rights of third parties that may result from its use. specifications subject to change without notice. no license is granted by implication or otherwise under any patent or patent rights of analog devices. trademarks and registered trademarks are the property of their respective owners. one technology way, p.o. box 9106, norwood, ma 02062-9106, u.s.a. tel: 781.329.4700 www.analog.com fax: 781.461.3113 ?2010 analog devices, inc. all rights reserved. features high precision adc dual channel, simultaneous sampling, 16-bit, - adcs programmable adc throughput from 10 hz to 1 khz on-chip 5 ppm/oc voltage reference current channel fully differential, buffered input programmable gain adc input range: ?200 mv to +300 mv digital comparator with current accumulator feature voltage channel buffered, on-chip attenuator for 12 v battery input temperature channel external and on-chip temperature sensor options microcontroller arm7tdmi-s core, 16-/32-bit risc architecture 20.48 mhz pll on-chip precision oscillator jtag port supports code download and debug memory 64 kb flash/ee memory options, 4-kb sram 10,000-cycle flash/ee endurance, 20-year flash/ee retention in-circuit download via jtag and lin on-chip peripherals saej2602/lin 2.1-compatible slave spi gpio port 1 general-purpose timer wake-up and watchdog timers on-chip power-on-reset power operates directly from 12 v battery supply current consumption 7.5 ma (10 mhz) low power monitor mode package and temperature range 32-pin, 6 mm 6 mm lfcsp fully specified for ?40c to +115c operation applications battery sensing/management for automotive systems functional block diagram 16-bit - adc buf pga iin+ iin? result accumulator digital comparator 16-bit - adc mux buf tc k rtck tdi tdo ntrst tms vdd reg_avdd reg_dvdd agnd dgnd vss io_vss gpio_5 gpio_4 gpio_3/mosi gpio_2/miso gpio_1/sclk gpio_0/ss vbat vtemp gnd_sw precision analog acquisition 20mhz arm7tdmi mcu precision osc low power osc on-chip pll 1 timer wdt w/u timer gpio port spi port lin lin ldo por memory 64kb flash 4kb ram reset temperature sensor precision reference aduc7039 08463-001 figure 1.
aduc7039 rev. b | page 2 of 92 table of contents features .............................................................................................. 1 applications ....................................................................................... 1 functional block diagram .............................................................. 1 revision history ............................................................................... 2 specifications ..................................................................................... 3 electrical specifications ............................................................... 3 timing specifications .................................................................. 7 absolute maximum ratings ............................................................ 8 esd caution .................................................................................. 8 pin configuration and function descriptions ............................. 9 terminology .................................................................................... 11 theory of operation ...................................................................... 12 overview of the arm7tdmi-s core ..................................... 12 memory organization ............................................................... 14 reset ............................................................................................. 15 flash/ee memory ........................................................................... 16 flash/ee mmr interface ........................................................... 16 flash/ee memory signature ..................................................... 20 flash/ee memory security ....................................................... 21 flash/ee memory reliability .................................................... 23 aduc7039 kernel ...................................................................... 23 memory mapped registers (mmr) ............................................. 25 complete mmr listing ............................................................. 26 16-bit, sigma-delta analog-to-digital converters ................... 29 adc ground switch .................................................................. 32 adc noise performance tables ............................................... 32 adc mmr interface ................................................................. 33 adc sinc3 digital filter response .......................................... 42 adc modes of operation ......................................................... 43 adc configuration ................................................................... 45 i-adc diagnostics ..................................................................... 46 power supply support circuits ..................................................... 47 system clocks ................................................................................. 48 oscillators calibration ............................................................... 53 interrupt system ............................................................................. 58 timers .............................................................................................. 60 synchronization of timers across asynchronous clock domains ...................................................................................... 60 programming the timers .......................................................... 61 timer0general-purpose timer ........................................... 62 timer1wake-up timer ......................................................... 64 timer2watchdog timer ........................................................ 66 general-purpose input/output .................................................... 68 serial peripheral interface (spi) ................................................... 73 master in, slave out (miso) pin ............................................. 73 master out, slave in (mosi) pin ............................................. 73 serial clock i/o (sclk) pin ..................................................... 73 slave select ( ss ) pin ................................................................... 73 spi mmr interface .................................................................... 73 high voltage peripheral control interface ................................. 77 low voltage flag (lvf) ............................................................. 80 handling hv interface interrupt and hv communication 80 lin (local interconnect network) interface.............................. 82 lin physical interface ............................................................... 82 lin diagnostic ........................................................................... 83 lin communication ................................................................. 83 lin mmrs .................................................................................. 83 part identification ........................................................................... 87 recommended schematic ............................................................. 89 outline dimensions ....................................................................... 90 ordering guide .......................................................................... 90 revision history 8/10rev.a to rev. b changes to fast temperature conversion mode section ......... 46 changes to bit 4 description (lincon[6] reference) in table 62 ............................................................................................ 86 changes to part identification section ........................................ 87 6/10rev. 0 to rev. a added saej2602 to features section ............................................ 1 changes to table 2 ............................................................................ 9 changes to bit 2 and bit 1 descriptions in table 34 .................. 39 changes to system clocks section ............................................... 49 added syncronization of timers across asynchronous clock domains section, figure 23, and figure 24 ................................ 60 added programming the timers section ................................... 61 changes to recommended schematic text ................................ 89 3/10revision 0: initial version
aduc7039 rev. b | page 3 of 92 specifications electrical specifications v dd = 3.5 v to 18 v, v ref = 1.2 v internal reference, f core = 20.48 mhz driven from on-chip precision oscillator, all specifications t a = ?40c to +115c, unless otherwise noted. table 1. parameter test conditions/comments min typ max unit adc specifications conversion rate 1 adc normal operating mode 10 1000 hz adc low power mode, chop on 10 650 hz current channel no missing codes 1 valid for all adc update rate s and adc modes 16 bits integral nonlinearity 1 , 2 10 60 ppm of fsr offset error 1 , 2 , 3 chop off, external short, af ter user system calibration, 1 lsb = (36.6/gain) v ?10 3 +10 lsb offset error 1 , 3 chop on, external short, low power mode, mcu powered down +250 50 ?300 nv offset error 1 , 3 chop on, external short, af ter user system calibration tested at cd = 0, vdd = 18 v 0 3.0 v offset error 1 , 3 chop on, external short, af ter user system calibration tested at cd = 0, vdd = 4 v 0.5 v offset error drift 1 , 2 , 4 chop off, gains of 8 to 64, normal mode 0.03 lsb/c offset error drift 1 , 4 chop off, valid for adc gain of 512 30 nv/c offset error drift 1 , 4 chop on 5 nv/c total gain error 1 , 3 , 5 , 6 factory calibrated at a gain of 4; normal mode ?0.5 0.1 +0.5 % low power mode ?1 0.2 +1 % gain drift 1 , 7 3 ppm/c pga gain mismatch error 0.1 % output noise 1 10 hz update rate, gain = 512, chop enabled 100 150 nv rms 1 khz update rate, gain = 512, adcflt = 0x0007 0.6 0.9 v rms 1 khz update rate, gain = 32, ad cflt = 0x0007 0.8 1.2 v rms 1 khz update rate, gain = 8, ad cflt = 0x8101 2.1 4.1 v rms 1 khz update rate, gain = 8, ad cflt = 0x0007 1.6 2.4 v rms 1 khz update rate, gain = 4, ad cflt = 0x0007 2.6 3.9 v rms adc low power mode, 250hz update rate, chop enable, gain = 512 0.6 0.9 v rms voltage channel 8 no missing codes 1 valid at all adc update rates 16 bits integral nonlinearity 1 10 60 ppm of fsr offset error 1 , 3 chop off, 1 lsb = 439.5 v, after two point calibration ?10 1 +10 lsb offset error 1 , 3 chop on, after two point calibration ?1 0.3 +1 lsb offset error drift 4 chop off 0.03 lsb/c total gain error 1 , 3 , 5 , 6 includes resistor mismat ch ?0.25 0.06 +0.25 % total gain error 1 , 3 , 5 , 6 temperature range = ?25c to +65c ?0.15 0.03 +0.15 % gain drift 1 , 7 includes resistor mismat ch drift 3 ppm/c output noise 1 , 9 10 hz update rate, chop on 60 90 v rms 1 khz update rate, adcflt = 0x0007 180 270 v rms temperature channel no missing codes 1 valid at all adc update rates 16 bits integral nonlinearity 1 10 60 ppm of fsr offset error 3 , 10 chop off, 1 lsb = 19.84 v (in unipolar mode) ?10 3 +10 lsb offset error 1 , 3 chop on ?5 +1 +5 lsb offset error drift 1 chop off 0.03 lsb/c total gain error 1 , 3 , 10 vref = (reg_avdd, gnd_sw)/2 ?0.25 0.06 +0.25 % gain drift 1 3 ppm/c output noise 1 1 khz update rate 7.5 11.25 v rms
aduc7039 rev. b | page 4 of 92 parameter test conditions/comments min typ max unit adc specifications, analog input current channel absolute input voltage range 1 applies to both iin+ and iin? ?200 +300 mv input voltage range 11 , 12 gain = 4 300 mv gain = 8 150 mv gain = 32 37.5 mv gain = 512 2.3 mv input leakage current 1 ?3 +3 na input offset current 1 , 13 0.5 1.5 na voltage channel absolute input voltage range 1 voltage adc specifications are valid in this range 4 18 v input voltage range 1 0 to 28.8 v vbat input current vbat = 18 v 3 5.5 8 a temperature channel v ref = (reg_avdd, gnd_sw)/2 absolute input voltage range 14 100 1300 mv input voltage range 1 0 to v ref v vtemp input current 1 2.5 100 na voltage reference internal vref 1.2 v power-up time 1 0.5 ms initial accuracy 1 measured at t a = 25c ?0.15 +0.15 % temperature coefficient 1 , 15 ?20 5 +20 ppm/c long-term stability 16 100 ppm/1000 hr adc diagnostics vref/136 accuracy 1 at any gain setting 8.4 9.4 mv voltage attenuator current differential voltage increase on the attenuator when current is on 2.3 3.6 v source accuracy 1 resistive attenuator 1 divider ratio 24 resistor mismatch drift included in the vo ltage channel total gain error 3 ppm/c adc ground switch resistor to ground 15 20 30 k temperature sensor 17 uncalibrated accuracy mcu in power down or standby mode; t a = ?40c to +85c ?10 3 +10 c mcu in power down or standby mode; t a = ?20c to +60c ?8 2 +8 oc calibrated ? adc2gn = 0x968a; mcu in power down or standby mode ?4 2 +4 c power-on reset (por) 1 por trip level refers to voltage at the vdd pin 2.85 3.0 3.15 v por hysteresis 300 mv reset timeout from por 20 ms low voltage flag(lvf) lvf level refers to voltage at the vdd pin 1.9 2.1 2.3 v watchdog timer (wdt) timeout period 1 32 khz clock, 256 prescale 0.008 524 seconds timeout step size 7.8 ms flash/ee memory 1 endurance 18 10,000 cycles data retention 19 20 years digital inputs 1 all digital inputs except ntrst input leakage current input (h igh) = reg_dvdd 1 10 a input pull-up current 1 input (low) = 0 v 10 20 80 a input capacitance 1 10 pf input leakage current ntrst only; input (low) = 0 v 1 10 a input pull-down current ntrst only; input (high) = reg_dvdd 30 55 100 a
aduc7039 rev. b | page 5 of 92 parameter test conditions/comments min typ max unit logic inputs 1 all logic inputs input low voltage (vinl) 0.4 v input high voltage (vinh) 2.0 v on-chip oscillators low power oscillator 128 khz accuracy after user calibration at nominal supply and room temperature; includes drift data from 1000 hr life-test ?3 +3 % precision oscillator 128 khz accuracy after run time calibration ?1 +1 % mcu clock rate 1 10.24 mhz mcu start-up time 1 at power-on includes kernel power-on execution time 25 ms after reset event includes kernel power-on execution time 5 ms from mcu power-down oscillator running 2 ms internal pll lock time 1 ms lin i/o general baud rate 1000 20,000 bits/sec v dd supply voltage range for which the li n interface is functional 7 18 v input capacitance 1 5.5 pf lin comparator response time 1 using 22 resistor 38 90 s lin dc parameters i lin dom max current limit for driver when lin bus is in dominant state; vbat = vbat (maximum) 40 200 ma i lin_pas_rec 1 driver off; 7.0 v < v bus < 18 v; v dd = v lin ? 0.7 v 20 a i lin_pas_dom 1 input leakage, v lin = 0 v ?1 ma i lin_no_gnd 1 , 20 control unit disconnected from ground, gnd = v dd ; 0 v < v lin < 18 v; vbat = 12 v ?1 +1 ma i bus_no_bat 1 vbat disconnected, v dd = gnd, 0 v < v bus < 18 v 100 a v lin_dom 1 lin receiver dominant state, v dd > 7.0 v 0.4 v dd v v lin_rec 1 lin receiver recessive state, v dd > 7.0 v 0.6 v dd v v lin_cnt 1 lin receiver center voltage, v dd > 7.0 v 0.475 v dd 0.5 v dd 0.525 v dd v v hys 1 lin receiver hysteresis voltage 0.175 v dd v v lin_dom_drv_losup 1 lin dominant output voltage; v dd = 7.0 v r l 500 1.2 v r l 1000 0.6 v v lin_dom_drv_hisup 1 lin dominant output voltage; v dd = 18 v r l 500 2 v r l 1000 0.8 v v lin_recessive 1 lin recessive output voltage 0.8 v dd v vbat shift 20 0 0.115 v dd v gnd shift 20 0 0.115 v dd v r slave slave termination resistance 20 30 47 k v serial diode 20 voltage drop at the serial diode, d ser_int 0.4 0.7 1 v lin ac parameters 1 bus load conditions (cbus||rbus): 1 nf||1 k; 6.8 nf||660 ; 10 nf||500 d1 duty cycle 1 0.396 th rec(max) = 0.744 vbat th dom(max) = 0.581 vbat v sup = 7.0 v 18 v; t bit = 50 s d1 = t bus_rec(min) /(2 t bit ) d2 duty cycle 2 0.581 th rec(min) = 0.284 vbat th dom(min) = 0.422 vbat v sup = 7.0 v 18 v; t bit = 50 s d2 = t bus_rec(max) /(2 t bit )
aduc7039 rev. b | page 6 of 92 parameter test conditions/comments min typ max unit d3 1, 20 th rec(max) = 0.778 vbat 0.417 th dom(max) = 0.616 vbat v dd = 7.0 v ... 18 v t bit = 96 s d3 = t bus_rec(min) /(2 t bit ) d4 1, 20 th rec(min) = 0.389 vbat 0.590 th dom(min) = 0.251 vbat v dd = 7.0 v 18 v t bit = 96 s d4 = t bus_rec(max) /(2 t bit ) t rx_pdr 1, 20 propagation delay of receiver 6 s t rx_sym 1, 20 symmetry of receiver propagation delay rising edge, with respect to falling edge (t rx_sym = t rf_pdr ? t rx_pdf ) ?2 +2 s package thermal specifications thermal impedance ( ja ) 21 32-lead csp, stacked die 32 c/w power requirements 1 power supply voltages vdd (battery supply) 3.5 18 v reg_dvdd, reg_avdd 22 2.45 2.6 2.75 v power consumption i dd (mcu normal mode) 23 adc off (20.48 mhz) 10 20 ma adc off (10.24 mhz) 7.5 16 ma i dd (mcu powered down) 1 adc low power mode, measured over an ambient temperature range of t a = ?10c to +40c, continuous adc conversion 750 1000 a i dd (mcu powered down) 1 precision oscillator turned off, adc off average current, measured with wake-up and watchdog timers clocked from low power oscillator (?40c to +85c) 95 300 a average current, measured with wake-up and watchdog timers clocked from low power oscillator over an ambient temperature range of ?10c to +40c 95 175 a i dd (current adc) 1.7 ma i dd (voltage/temperature adc) 0.5 ma i dd (precision oscillator) 400 a 1 not guaranteed by production test but by design and/or characterization data at production release. 2 valid for current adc gain setting of pga up to 64. 3 these numbers include temperature drift. 4 the offset error drift is included in the offset error. this ty pical specification is an indica tor of the offset error due to temperature drift. this typical value is the mean of the temperature drift characterization data distribution. 5 includes internal refe rence temperature drift. 6 user system calibration removes this error at a given te mperature and at a given gain on the current channel. 7 the gain drift is included in the total gain error. this typical specification is an indicator of the gain error due to temper ature drift. this typical value is the mean of the temperature drift characterization data distribution. 8 voltage channel specifications includ e resistive attenuator input stage. 9 rms noise is referred to voltage a ttenuator input; for example, at f adc = 1 khz, typical rms noise at the adc input is 7.5 v, scaled by the attenuator (24) yields these input referred noise figures. 10 valid after an initial self calibration. 11 it is possible to extend the adc input range by up to 10% by modifying the factory set value of the gain calibration register or using system calibration. this approach can also be used to reduce the adc input range (lsb size). 12 in adc low power mode, the inpu t range is fixed at 2.34375 mv. 13 valid for a differential input less than 10 mv. 14 the absolute value of the vo ltage of vtemp and gnd_ sw must be 100mv minimum, for accurate operation of the t-adc. 15 measured using box method. 16 the long-term stability specification is noncumulative. the drift in subsequent 1000 hour periods is sign ificantly lower than in the first 1000 hour period. 17 die temperature. 18 endurance is qualified to 10,000 cycles, as per jedec std. 22 method a117 and measured at ?40c, +25c, and +125c. typical en durance at 25c is 170,000 cycles. 19 retention lifetime equivalent at junction temperature (t j ) = 85c, as per jedec std. 22 method a117. retenti on lifetime derates wi th junction temperature. 20 these numbers are not production tested bu t are supported by lin compliance testing. 21 thermal impedance can be used to calculate the thermal gradient from ambient to die temperature. 22 internal regulated supply available at reg_dvdd (i source = 5 ma) and reg_avdd (i source =1 ma). 23 typical additional supply current consumed during flash/ee memory program and erase cycles is 7 ma and 5 ma, respectively.
aduc7039 rev. b | page 7 of 92 timing specifications lin timing specifications transmit input to transmitting node v sup (transceiver supply of transmitting node) rxd (output of receiving node 1) rxd (output of receiving node 2) recessive th rec (max) t lin_dom (max) t lin_rec (min) t lin_dom (min) t lin_rec (max) th dom (max) th rec (min) th dom (min) dominant thresholds of receiving node 1 lin bus thresholds of receiving node 2 t bit t bit t bit t rx_pdr t rx_pdr t rx_pdf t rx_pdf 08463-002 figure 2. lin 2.1 timing specification
aduc7039 rev. b | page 8 of 92 absolute maximum ratings t a = ?40c to +115c, unless otherwise noted. stresses above those listed under absolute maximum ratings may cause permanent damage to the device. this is a stress rating only; functional operation of the device at these or any other conditions above those indicated in the operational section of this specification is not implied. exposure to absolute maximum rating conditions for extended periods may affect device reliability. table 2. parameter rating agnd to dgnd to vss to io_vss ?0.3 v to +0.3 v vbat to agnd ?22 v to +40 v vdd to vss ?0.3 v to +40 v lin to io_vss ?16 v to +40 v lin short-circuit current 1 200 ma digital i/o voltage to dgnd ?0.3 v to reg_dvdd + 0.3 v adc inputs to agnd ?0.3 v to reg_avdd + 0.3 v esd (hbm) rating hbm-adi0082 (based on ansi/esd stm5.1-2007); all pins except lin and vbat 2.5 kv lin and vbat 6 kv iec61000-4-2 for lin and vbat 7 kv storage temperature 150c junction temperature transient 150c continuous 130c lead temperature soldering reflow (15 sec) 260c esd caution 1 200 ma can be sustained on the lin pi n for 2 seconds. the active internal short circuit protection hvcfg[1] = 0 is required to be enabled on this device during lin operation and is the default operation. this disconnects the lin pin, if a short circuit event occurs, after the specified maximum period of 90 s.
aduc7039 rev. b | page 9 of 92 notes: 1. for details on nc pins, see the pin function descriptions table. 2. epad is internally connected to dgnd. 1 gpio_3/mosi 2 gpio_2/miso 3 gpio_1/sclk 4 gpio_0/ss 5 dgnd 6 reg_dvdd 7 reg_dvdd 8r e g _ a v d d 24 23 22 21 20 19 18 17 reset tdo tck tms tdi ntrst rtck nc 9 10 11 12 13 14 15 16 gnd_sw vtemp agnd iin+ iin? agnd agnd reg_avdd 32 31 30 29 28 27 26 25 gpio_5 vss io_vss lin vbat vdd nc gpio_4 top view (not to scale) aduc7039 pin configuration and fu nction descriptions 8463-003 0 figure 3. pin configuration table 3. pin function descriptions pin no. mnemonic type 1 description 1 reset i reset input pin. active low. this pin has an internal, weak, pull-up resistor to reg_dvdd. when not in use, this pin can be left unconnected. for added secu rity and robustness, it is recommended that this pin be strapped via a resistor to reg_dvdd. 2 tdo o jtag test data output. this data output pin is on e of the standard 6-pin jtag debug ports on the part. tdo is an output pin only. at power-on, this output is disabled and pulled high via an internal, weak, pull-up resistor. this pin can be left unconnected when not in use. 3 tck i jtag test clock. this clock input pin is one of the standard 6-pin jtag debug ports on the part. tck is an input pin only and has an internal, weak, pull-up resistor. this pin can be left unconnected when not in use. 4 tms i jtag test mode select. this mode select input pin is one of the standard 6-pin jtag debug ports on the part. tms is an input pin only and has an internal, weak, pull-up resistor. this pin can be left unconnected when not in use. 5 tdi i jtag test data input. this data input pin is one of the standard 6-pin jtag debug ports on the part. tdi is an input pin only and has an internal, weak, pull-up resistor. this pin can be left unconnected when not in use. 6 ntrst i jtag test reset. this reset input pin is one of the standard 6-pin jtag debug ports on the part. ntrst is an input pin only and has an internal, weak, pull-down resistor. this pin can be left uncon- nected when not in use. ntrst is also monitored by the on-chip kernel to enable lin boot load mode. 7 rtck o jtag return test clock. this output pin is used to adjust the jtag clock speed to the highest possible rate of the aduc7039. 8 nc no connect. this pin is internally connected; therefore, do not externally connect this pin. 9 gnd_sw i switch to internal analog ground reference. this pi n is the negative input for the external temperature channel and external reference. if this input is not used, connect it directly to the agnd system ground. 10 vtemp i external pin for ntc/ptc temperature measurement. 11, 14, 15 agnd s ground reference for on-chip precision analog circuits. 12 iin+ i positive differential input for current channel. 13 iin? i negative differential input for current channel. 16, 17 reg_avdd s nominal 2.6 v analog output from on-chip regulato r. pin 16 and pin 17 must be connected together to a capacitor to ground. 18, 19 reg_dvdd s nominal 2.6 v digital output from on-chip regulator. pin 18 and pin 19 must be connected together to capacitors to ground. 20 dgnd s ground reference for on-chip digital circuits.
aduc7039 rev. b | page 10 of 92 pin no. mnemonic type 1 description 21 gpio_0/ ss i/o general-purpose digital i/o 0, or spi interface. by default, this pin is configured as an input. the pin has an internal, weak, pull-up resistor and, when not in use, can be left unconnected. this multifunction pin can be configured in one of two states, namely general-purpose digital i/o 0. spi interface, slave select input. 22 gpio_1/sclk i/o general-purpose digital i/o 1 or spi interface. by defa ult, this pin is configured as an input. the pin has an internal, weak, pull-up resistor and, when not in use, can be left unconnected. this multifunction pin can be configured in one of two states, namely general-purpose digital i/o 1. spi interface, serial clock input. 23 gpio_2/miso i/o general-purpose digital i/o 2 or spi interface. by defa ult, this pin is configured as an input. the pin has an internal, weak, pull-up resistor and, when not in use, can be left unconnected. this multifunction pin can be configured in one of two states, namely general-purpose digital i/o 2. spi interface, master input/slave output pin. 24 gpio_3/mosi i/o general-purpose digital i/o 3 or spi interface. by defa ult, this pin is configured as an input. the pin has an internal, weak, pull-up resistor and, when not in use, can be left unconnected. this multifunction pin can be configured in one of two states, namely general-purpose digital i/o 3. spi interface, master output/slave input pin. 25 gpio_4 i/o general-purpose i/o 4. by default, this pin is conf igured as an input. the pin has an internal, weak, pull-up resistor and when not in use, can be left unconnected. 26 nc no connect. this pin is not internally connected, but is reserved for possible future use. therefore, do not externally connect this pin. 27 vdd s battery power supply to on-chip regulator. 28 vbat i battery voltage input to resistor divider. 29 lin i/o lin serial interface input/output pin. 30 io_vss s ground reference for lin pin. 31 vss s ground reference. this is the ground reference for the internal voltage regulators. 32 gpio_5 i/o general-purpose i/o 5. by default, this pin is conf igured as an input. the pin has an internal, weak, pull-up resistor and when not in use, can be left unconnected. epad epad the exposed pad is internally connected to dgnd. 1 i = input, o = output, s = supply.
aduc7039 rev. b | page 11 of 92 terminology conversion rate the conversion rate specifies the rate at which an output result is available from the adc, after the adc has settled. the sigma-delta (-) conversion techniques used on this part mean that while the adc front-end signal is oversampled at a relatively high sample rate, a subsequent digital filter is used to decimate the output giving a valid 16-bit data conversion result at output rates from 1 hz to 1 khz. note that when software switches from one input to another (on the same adc), the digital filter must first be cleared and then allowed to average a new result. depending on the con- figuration of the adc and the type of filter, this can require multiple conversion cycles. integral nonlinearity (inl) inl is the maximum deviation of any code from a straight line passing through the endpoints of the transfer function. the endpoints of the transfer function are zero scale, a point ? lsb below the first code transition, and full scale, a point ? lsb above the last code transition (111 . . . 110 to 111 . . . 111). the error is expressed as a percentage of full scale. no missing codes no missing codes is a measure of the differential nonlinearity of the adc. the error is expressed in bits and specifies the number of codes (adc results) as 2 n bits, where n = no missing codes, guaranteed to occur through the full adc input range. offset error offset error is the deviation of the first code transition adc input voltage from the ideal first code transition. offset error drift offset error drift is the variation in absolute offset error with respect to temperature. this error is expressed as lsb/c or nv/c. gain error gain error is a measure of the span error of the adc. it is a measure of the difference between the measured and the ideal span between any two points in the transfer function. output noise the output noise is specified as the standard deviation (or 1 ) of adc output codes distribution collected when the adc input voltage is at a dc voltage. it is expressed as v or nv rms. the output, or rms noise, can be used to calculate the effective resolution of the adc as defined by the following equation: effective resolution = log 2 ( full-scale range/rms noise ) bits the peak-to-peak noise is defined as the deviation of codes that fall within 6.6 of the distribution of adc output codes col- lected when the adc input voltage is at dc. the peak-to-peak noise is, therefore, calculated as 6.6 the rms noise. the peak-to-peak noise can be used to calculate the adc (noise free, code) resolution for which there is no code flicker within a 6.6 limit as defined by the following equation: noise free code resolution = log 2 ( full-scale range / peak- to-peak noise ) bits table 4. data sheet acronyms acronym definition adc analog-to-digital converter arm advanced risc machine jtag joint test action group lin local interconnect network lsb least significant byte/bit mcu microcontroller mmr memory mapped register msb most significant byte/bit otp one time programmable pid protected identifier por power-on reset rms root mean square
aduc7039 rev. b | page 12 of 92 theory of operation the aduc7039 is a complete system solution for battery moni- toring in 12 v automotive applications. this device integrates all of the required features to precisely and intelligently monitor, process, and diagnose 12 v battery parameters including battery current, voltage, and temperature over a wide range of operat- ing conditions. minimizing external system components, the device is powered directly from the 12 v battery. an on-chip, low dropout regula- tor generates the supply voltage for two integrated, 16-bit, - adcs. the adcs precisely measure battery current, voltage, and temperature to characterize the state of health and charge of the car battery. a flash/ee memory-based arm7? microcontroller (mcu) is also integrated on-chip. it is used to both preprocess the acquired battery variables and to manage communications from the aduc7039 to the main electronic control unit (ecu) via a local interconnect network (lin) interface that is integrated on-chip. the mcu can be configured to operate in normal or flexible power saving modes of operation. in its normal operating mode, the mcu is clocked indirectly from an on-chip oscillator via the phase-locked loop (pll) at a maximum clock rate of 10.24 mhz. in its power saving oper- ating modes, the mcu can be totally powered down, waking up only in response to the wake-up timer, a por, or a lin communication event. the adc can be configured to operate in a normal (full power) mode of operation, interrupting the mcu after various sample conversion events. on-chip factory firmware supports in-circuit flash/ee repro- gramming via the lin or jtag serial interface ports, and nonintrusive emulation is also supported via the jtag interface. these features are incorporated into a low cost quickstart? development system supporting the aduc7039. the aduc7039 operates directly from the 12 v battery supply and is fully specified over a temperature range of ?40c to +115c. the aduc7039 is functional, but with degraded performance, at temperatures from 115c to 125c. overview of the arm7tdmi-s core the arm7 core is a 32-bit, reduced instruction set computer (risc), developed by arm? ltd. the arm7tdmi-s is a von neumann-based architecture, meaning that it uses a single 32-bit bus for instruction and data. the length of the data can be 8, 16, or 32 bits, and the length of the instruction word is either 16 bits or 32 bits, depending on the mode in which the core is operating. the arm7tdmi-s is an arm7 core with four additional features, as listed in table 5 . table 5. arm7tdmi-s feature description t support for the thumb? (16-bit) instruction set d support for debug m enhanced multiplier i includes the embeddedice? module to support embedded system debugging thumb mode (t) an arm instruction is 32 bits long. the arm7tdmi-s proces- sor supports a second instruction set compressed into 16 bits, the thumb instruction set. faster code execution from 16-bit memory and greater code density can be achieved by using the thumb instruction set, making the arm7tdmi-s core particularly suited for embedded applications. however, the thumb mode has three limitations. ? relative to arm, the thumb code usually requires more instructions to perform that same task. therefore, arm code is best for maximizing the performance of time- critical code in most applications. ? the thumb instruction set does not include some instructions that are needed for exception handling, so arm code can be required for exception handling. ? when an interrupt occurs, the core vectors to the interrupt location in memory and executes the code present at that address. the first command is required to be in arm code. multiplier (m) the arm7tdmi-s instruction set includes an enhanced multiplier, with four extra instructions to perform 32-bit by 32-bit multiplication with a 64-bit result, and 32-bit by 32-bit multiplication-accumulation (mac) with a 64-bit result. embeddedice (i) the embeddedice module provides integrated on-chip debug support for the arm7tdmi-s. the embeddedice module contains the breakpoint and watchpoint registers that allow nonintrusive user code debugging. these registers are controlled through the jtag test port. when a breakpoint or watchpoint is encountered, the processor halts and enters the debug state. once in a debug state, the processor registers can be interrogated, as can the flash/ee, sram, and memory mapped registers.
aduc7039 rev. b | page 13 of 92 arm7 exceptions the arm7 supports five types of exceptions, with a privileged processing mode associated with each type. the five types of exceptions are as follows: ? normal interrupt or irq. this is provided to service general-purpose interrupt handling of internal and external events. ? fast interrupt or fiq. this is provided to service data transfer or a communication channel with low latency. fiq has priority over irq. ? memory abort (prefetch and data). ? attempted execution of an undefined instruction. ? software interrupt (swi) instruction that can be used to make a call to an operating system. typically, the programmer defines interrupts as irq, but for higher priority interrupts, the programmer can define interrupts as the fiq type. the priority of these exceptions and the vector addresses are listed in table 6 . table 6. exception priorities and vector addresses priority exception address 1 hardware reset 0x00 2 memory abort (data) 0x10 3 fiq 0x1c 4 irq 0x18 5 memory abort (prefetch) 0x0c 6 software interrupt 1 0x08 6 undefined instruction 1 0x04 1 a software interrupt and an undefined instruction exception have the same priority and are mutually exclusive. arm registers the arm7tdmi-s has 16 standard registers. r0 to r12 are used for data manipulation, r13 is the stack pointer, r14 is the link register, and r15 is the program counter that indicates the instruction currently being executed. the link register contains the address from which the user has branched (if the branch and link command was used) or the command during which an exception occurred. the stack pointer contains the current location of the stack. as a general rule, on an arm7tdmi-s, the stack starts at the top of the available ram area and descends using the area as required. a separate stack is defined for each of the exceptions. the size of each stack is user configurable and is dependent on the target application. on the aduc7039, the stack begins at 0x00040ffc and descends. when programming using high level languages, such as c, it is necessary to ensure that the stack does not over-flow. this is dependent on the performance of the compiler that is used. when an exception occurs, some of the standard registers are replaced with registers specific to the exception mode. all exception modes have replacement banked registers for the stack pointer (r13) and the link register (r14) as represented in figure 4 . the fiq mode has more registers (r8 to r12) supporting faster interrupt processing. with the increased number of noncritical registers, the interrupt can be processed without the need to save or restore these registers, thereby reducing the response time of the interrupt handling process. more information relative to the programmers model and the arm7tdmi-s core architecture can be found in arm7tdmi-s technical and arm architecture manuals available directly from arm ltd. usable in user mode system modes only spsr_und spsr_irq spsr_abt spsr_svc r8_fiq r9_fiq r10_fiq r11_fiq r12_fiq r13_fiq r14_fiq r13_und r14_und r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 (pc) r13_irq r14_irq r13_abt r14_abt r13_svc r14_svc spsr_fiq cpsr user mode fiq mode svc mode abort mode irq mode undefined mode 08463-004 figure 4. register organization interrupt latency the worst-case latency for an fiq consists of the longest time the request can take to pass through the synchronizer, and the time for the longest instruction to complete (the longest instruc- tion is an ldm that loads all the registers including the pc), plus the time for the data abort entry and the time for fiq entry. at the end of this time, the arm7tdmi-s is executing the instruction at 0x1c (fiq interrupt vector address). the maximum total time is 50 processor cycles, or just under 5 s in a system using a continuous 10.24 mhz processor clock. the maximum irq latency calculation is similar but must allow for the fact that fiq has higher priority and could delay entry into the irq handling routine for an arbitrary length of time. this time can be reduced to 42 cycles if the ldm command is not used; some compilers have an option to compile without using this command. another option is to run the part in thumb mode where this is reduced to 22 cycles. the minimum latency for fiq or irq interrupts is five cycles. this consists of the shortest time the request can take through the synchronizer and the time to enter the exception mode. note that the arm7tdmi-s initially (first instruction) runs in arm (32-bit) mode when an exception occurs. the user can immediately switch from arm mode to thumb mode if required, for example, when executing interrupt service routines.
aduc7039 rev. b | page 14 of 92 memory organization the arm7, a von neumann architecture, mcu core sees mem- ory as a linear array of 2 32 byte locations. as shown in figure 5 , the aduc7039 maps this into four distinct user areas, namely: a memory area that can be remapped, an sram area, a flash/ee area, and a memory mapped register (mmr) area. 0x0040fff 0x00040000 0xffff0fff 0xffff0000 mmrs 0x0008ffff 0x00080000 flash/ee sram 0x0000f7ff 0x00000000 remappable memory space (flash/ee or sram) reserved reserved reserved reserved 0 8463-005 figure 5. aduc7039 memory map, 64 kb flash option ? the first 64 kb of this memory space is used as an area into which the on-chip flash/ee or sram can be remapped. ? the aduc7039 features a second 4 kb area at the top of the memory map used to locate the mmrs, through which all on-chip peripherals are configured and monitored. ? the aduc7039 features an sram size of 4 kb. ? the aduc7039 features 64 kb of on-chip flash/ee memory. however, 62 kb of on-chip flash/ee memory are available to the user. in addition, 2 kb are reserved for the on-chip kernel. any access, either reading or writing, to an area not defined in the memory map results in a data abort exception. memory format the aduc7039 memory organization is configured in little endian format: the least significant byte is located in the lowest byte address, and the most significant byte in the highest byte address. bit 31 byte 2 a 6 2 . . . byte 3 b 7 3 . . . byte 1 9 5 1 . . . byte 0 8 4 0 . . . bit 0 32 bits 0xffffffff 0x00000004 0x00000000 0 8463-007 figure 6. little endian format sram the aduc7039 features 4 kb of sram, organized as 1024 32 bits, that is, 1024 words, which is located at 0x40000. the ram space can be used as data memory and also as a volatile program space. arm code can run directly from sram at full clock speed given that the sram array is configured as a 32-bit wide memory array. sram is read/writeable in 8-, 16-, and 32-bit segments. remap the arm exception vectors are all situated at the bottom of the memory array, from address 0x00000000 to address 0x00000020. by default, after a reset, the flash/ee memory is logically mapped to address 0x00000000. it is possible to logically remap the sram to address 0x00000000. this is accomplished by setting bit 0 of the sysmap mmr located at 0xffff0220. to revert flash/ee to 0x00000000, bit 0 of sysmap is cleared. it is sometimes desirable to remap ram to 0x00000000 to execute code from sram while erasing a page of flash/ee memory. remap operation when a reset occurs on the aduc7039, execution starts auto- matically in the factory programmed internal configuration code. this so-called kernel is hidden and cannot be accessed by user code. if the aduc7039 is in normal mode, it executes the power-on configuration routine of the kernel and then jumps to the reset vector, address 0x00000000, to execute the users reset exception routine. because the flash/ee is mirrored at the bottom of the memory array at reset, the reset routine must always be written in flash/ee.
aduc7039 rev. b | page 15 of 92 the remap command must be executed from the absolute flash/ee address, and not from the mirrored, remapped segment of memory, because this may be replaced by sram. if a remap operation is executed while operating code from the mirrored location, prefetch/data aborts can occur, or the user can observe abnormal program operation. any kind of reset logically remaps the flash/ee memory to the bottom of the memory array. sysmap register name: sysmap address: 0xffff0220 default value: updated by the kernel access: read/write function: this 8-bit register allows user code to remap either ram or flash/ee space into the bottom of the arm memory space starting at address 0x00000000. table 7. sysmap mmr bit designations bit description 7 to 1 reserved. these bits are reserved and should be written as 0 by user code. 0 remap bit. this bit is set by the user to remap the sram to 0x00000000. this bit is cleared automatically after reset to remap the flash/ee memory to 0x00000000. reset there are four kinds of reset: external reset, power-on-reset, watchdog reset, and software reset. the rststa register indicates the source of the last reset and can also be written by user code to initiate a software reset event. the bits in this register can be cleared to 0 by writing to the rstclr mmr at 0xffff0234. the bit designations in rstclr mirror those of rststa. these registers can be used during a reset exception service routine to identify the source of the reset. the implica- tions of all four kinds of reset event are tabulated in table 9 . rststa register name: rststa address: 0xffff0230 default value: n/a access: read/write function: this 8-bit register indicates the source of the last reset event and can also be written by user code to initiate a software reset. rstclr register name: rstclr address: 0xffff0234 access: write only function: this 8-bit write-only register clears the corresponding bit in rststa. table 8. rststa/rstclr mmr bit designations bit description 7 to 4 not used. these bits are not used and always read as 0. 3 external reset. this bit is set by hardware wh en an external reset occurs. this bit is cleared by setting the corresponding bit in rstclr. 2 software reset. this bit is set by user code to generate a software reset. this bit is cleared by setting the corresponding bit in rstclr. 1 1 watchdog timeout. this bit is set by hardware when a watchdog timeout occurs. this bit is cleared by setting the corresponding bit in rstclr. 0 power-on reset. this bit is set by hardware when a power-on-reset occurs. this bit is cleared by setting the corresponding bit in rstclr. 1 if the software reset bit in rststa is set, any write to rstclr that does not clear this bit generates a software reset. table 9. device reset implications impact reset reset external pins to default state kernel executed reset all external mmrs (excluding rststa) reset all hv indirect registers peripherals reset watchdog timer reset ram valid 1 rststa (status after reset event) por yes yes yes yes yes yes yes/no 2 rststa[0] = 1 watchdog yes yes yes yes yes no yes rststa[1] = 1 software yes yes yes yes yes no yes rststa[2] = 1 external pin yes yes yes yes yes no yes rststa[3] = 1 1 ram is not valid in the case of a reset following lin download. 2 the impact on ram is dependent on the hvsta[2] contents if lvf is enabled. when lvf is enabled using hvcfg[4], ram has not bee n corrupted by the por reset mechanism if the lvf status bit hvsta[2] is 1. see the low voltage flag (lvf) sect ion for more information.
aduc7039 rev. b | page 16 of 92 flash/ee memory the aduc7039 incorporates flash/ee memory technology on chip to provide the user with nonvolatile, in-circuit reprogrammable memory space. like eeprom, flash memory can be programmed in-system at a byte level, although it must first be erased, the erase being performed in page blocks. thus, flash memory is often and more correctly referred to as flash/ee memory. overall, flash/ee memory represents a step closer to the ideal memory device that includes nonvolatility, in-circuit program- mability, high density, and low cost. incorporated within the aduc7039, flash/ee memory technology allows the user to update program code space in-circuit, without the need to replace one-time programmable (otp) devices at remote operating nodes. the flash/ee memory is physically located at 0x80000. upon a hard reset, it logically maps to 0x00000000. the factory default contents of all flash/ee memory locations is 0xffff. flash/ee can be read in 8-/16-/32-bit segments, and written in segments of 16 bits. the flash/ee is rated for 10,000 endurance cycles. this rating is based on the number of times that each individual byte is cycled, that is, erased and programmed. implementing a redundancy scheme in the software ensures a greater than 10,000-cycle endurance. the user can also write data variables to the flash/ee memory during run-time code execution, for example, for storing diagnostic battery parameter data. the entire flash/ee is available to the user as code and non- volatile data memory. there is no distinction between data and program, because arm code shares the same space. the real width of the flash/ee memory is 16 bits, meaning that in arm mode (32-bit instruction), two accesses to the flash/ee are necessary for each instruction fetch. the arm7tdmi-s operates at a fixed 10.24 mhz clock frequency, but the flash/ee memory controller is operating at 20.48 mhz. this means that the flash/ee memory controller can transparently fetch the second 16-bit half-word (part of the 32-bit arm operation code) within a single core clock period. the page size of this flash/ee memory is 512 bytes. typically, it takes the flash/ee controller 20 ms to erase a page. to write a 16-bit word requires 50 s. it is possible to write to a single, 16-bit location at most twice between erases; that is, it is possible to walk bytes, not bits. if a location is written to more than twice, then it is possible to corrupt the contents of the flash/ee page. the flash/ee memory can be programmed in-circuit, using a serial download mode via the lin interface or the integrated jtag port. serial downloading (in-circuit programming) the aduc7039 facilitates code download via the lin pin. the protocol is documented in the an-946 application note, flash/ee memory programming via lin (protocol 6) . jtag access the aduc7039 features an on-chip jtag debug port to facilitate code download and debug. flash/ee mmr interface access to, and control of, the flash/ee memory on the aduc7039 is managed by an on-chip memory controller. the controller manages the flash/ee memory as a single block of 64 kb. note that if executing from flash/ee memory, the mcu core is halted until the command is completed. user software must ensure that the flash/ee controller has completed any erase or write cycle before the pll is powered down. if the pll is powered down before an erase or write cycle is completed, the flash/ee page can be corrupted. user code, lin, and jtag programming use the flash/ee control interface, consisting of the following mmrs: ? feesta: read-only register, reflects the status of the flash/ee control interface. ? feemod: sets the operating mode of the flash/ee control interface. ? feecon: 8-bit command register. the commands are interpreted as described in table 10 . ? feedat: 16-bit data register. ? feeadr: 16-bit address register. ? feesig: holds the 24-bit code signature as a result of the signature command being initiated. ? feehid: protection mmr. controls read and write protection of the flash/ee memory code space. if previously configured via the feepro register, feehid can require a software key to enable access. ? feepro: a buffer of the feehid register that stores the feehid value, thus, it automatically downloads to the feehid registers on subsequent reset and power-on events. the following sections provide detailed descriptions of the bit designations for each of the flash/ee control mmrs.
aduc7039 rev. b | page 17 of 92 feecon register name: feecon address: 0xffff0e08 default value: 0x07 access: read/write function: this 8-bit register is written by user code to control the operating modes of the flash/ee memory controller. table 10. command codes in feecon code command description 0x00 1 reserved reserved; this command should not be written by user code. 0x01 1 single read load feedat with the 16-bit data indexed by feeadr. 0x02 1 single write write feedat at the address indexed by feeadr. this operation takes 50 s. 0x03 1 erase write erase the page indexed by feeadr and write feed at at the location pointed by feeadr. this operation takes 20 ms. 0x04 1 single verify compare the contents of the locati on indexed by feeadr to the data in feedat. the result of the comparison is returned in feesta bit 1. 0x05 1 single erase erase the page indexed by feeadr. 0x06 1 mass erase erase 62 kb of user space. the 2 kb kernel is protected. this operation takes 2.48 seconds. to prevent accidental execution, a command sequence is required to execute this instruction; this is described in the command sequence for executing a mass erase section. 0x07 idle default command. 0x08 reserved reserved; this command should not be written by user code. 0x09 reserved reserved; this command should not be written by user code. 0x0a reserved reserved; this command should not be written by user code. 0x0b signature this command results in a 24-bit, lfsr-based si gnature being generated and loaded into feesig. see the flash/ee memory signature section. 0x0c protect this command can be run one time only. the valu e of feepro is saved and can be removed only with a mass erase (0x06) or with the software protection key. 0x0d reserved reserved; this command should not be written by user code. 0x0e reserved reserved; this command should not be written by user code. 0x0f ping no operation; interrupt generated. 1 the feecon always reads 0x07 immediately af ter execution of any of these commands.
aduc7039 rev. b | page 18 of 92 command sequence for executing a mass erase given the significance of the mass erase command, a specific code sequence must be executed to initiate this operation. 1. ensure feesta is cleared. 2. set bit 3 in feemod. 3. write 0xffc3 in feeadr. 4. write 0x3cff in feedat. 5. run the mass erase command (0x06) in feecon. this sequence is illustrated in the following example: int a = feesta; // ensure feesta is cleared feemod = 0x08 feeadr = 0xffc3 feedat = 0x3cff feecon = 0x06; //mass erase command while (feesta & 0x04){} //wait for command to finish feesta register name: feesta address: 0xffff0e00 default value: 0xxxx0 access: read only function: this 16-bit, read-only register can be read by user code and reflects the current status of the flash/ee memory cont roller. table 11. feesta mmr bit designation bit description 15 to 4 reserved. 3 flash/ee interrupt status bit. this bit is set automatically when an interrupt occurs, that is, when a command is complete and the flash/ee interrupt enable bit in the feemod register is set. this bit is cleared automatically when th e feesta register is read by user code. 2 flash/ee controller busy. this bit is set automatically when the flash/ee controller is busy. this bit is cleared automatically when the controller is not busy. 1 command fail. this bit is set automatically when a command written to feecon completes unsuccessfully. this bit is cleared automatically when th e feesta register is read by user code. 0 command successful. this bit is set automatically by mcu when a command is completed successfully. this bit is cleared automatically when th e feesta register is read by user code.
aduc7039 rev. b | page 19 of 92 feemod register name: feemod address: 0xffff0e04 default value: 0x0000 access: read/write function: this register is written by user code to configure the mode of operation of the flash/ee memory controller. table 12. feemod mmr bit designation bit description 15 to 7 not used. these bits are reserved for future functionality and should be written as 0 by user code. 6 to 5 flash/ee security lock bits. these bits must be written as [6:5] = 1, 0 to complete the flash/ee security protect sequen ce. 4 flash/ee controller command complete interrupt enable. this bit is set by user code to enable the flash/ee controlle r to generate an interrupt upon completion of a flash/ee command. this bit is cleared by user code to disable the generation of a flash/ee interrupt upon completion of a flash/ee command. 3 flash/ee erase/write enable. this bit is set by user code to enable th e flash/ee erase and write access via feecon. this bit is cleared by user code to disabl e the flash/ee erase and write access via feecon. 2 reserved. 1 flash/ee controller abort enable. this bit is set by user code to enable the flash/ee controller abort functionality. this bit is cleared by user code to disabl e the flash/ee controller abort functionality. 0 reserved. feeadr registers name: feeadr address: 0xffff0e10 default value: updated by kernel access: read/write function: this 16-bit register dictates the address upon which any flash/ee command executed via feecon acts. feedat registers name: feedat address: 0xffff0e0c default value: 0x0000 access: read/write function: this 16-bit register contains the data either read from, or to be written to, the flash/ee memory.
aduc7039 rev. b | page 20 of 92 flash/ee memory signature the entire 62 kb or the part of flash/ee memory available to the user can be signed using the feesig register and signature command. this feature automatically reads the code in that section of the memory specified by the feeadr and feedat mmrs: ? feeadr contains an address situated in the first half page of the section to be signed. ? feedat contains an address situated in the first half page above the last page of the section to be signed. see figure 7 in this example, page 0 and page 1 are signed. 0x80000 page 0 0x80200 page 1 0x80400 feedat = 0x04xx feeadr = 0x00xx 08463-008 figure 7. signature command indexing ? i f the 8 msb of feeadr and feedat are identical, that is, the mmrs point to the same page, nothing is signed. ? t he last two 16-bit locations are not included in the signature; they are reserved for the user-programmed signature. ? i t is possible to sign half pages, by specifying a half page address in feeadr and feedat. for example, to sign the second half of page 0 and the first half of page 1, feeadr = 0x0100 and feedat = 0x0300. this feature is also used by the on-chip kernel at power-up to check the validity of page 0 before jumping to user code. store the signature of page 0 at address 0x801fc when programming the device. see the aduc7039 kernel section for more details. flash/ee memory signature registers name: feesig address: 0xffff0e18 default value: updated by kernel access: read only function: this mmr contains a 24-bit signature of the flash/ee memory. example of user code signature int a = feesta; // ensure feesta is cleared feeadr = 0x0000; // start page address feedat = 0x0600; // stop (page + 1) address feecon = 0x0b; // signs page 0 to page 2 excluding // address 0x805fc while (feesta & 0x04){} // wait for command to finish user code can compare the content of feesig with the content of address 0x805fc. polynomial a software routine is provided by analog devices, inc. , to calculate the unique 24-bit signature.
aduc7039 rev. b | page 21 of 92 flash/ee memory security the 62 kb of flash/ee memory available to the user can be read- and write-protected using the feehid register. the msb of feehid (bit 31) protects the entire flash/ee from being read through jtag. bits[30:0] of feehid protect page 123 to page 0 from writing. each bit protects four pages, that is, 2 kb. on the 30 kb version, bits[30:15] are unused. the feepro register mirrors the bit definitions of the feehid mmr. the feepro mmr allows user code to lock the pro- tection or security configuration of the flash/ee memory so that the protection configuration is automatically loaded on subsequent power-on or reset events. this flexibility allows the user to temporarily set and test protection settings using the feehid mmr and, subsequently, lock the required protection configuration (using feepro) when shipping protection systems into the field. flash/ee memory protection registers name: feehid and feepro address: 0xffff0e20 (for feehid) and 0xffff0e1c (for feepro) default value: 0xffffffff (for feehid) and 0x00000000 (for feepro) access: read/write function: these registers are written by user code to configure the protection of the flash/ee memory. table 13. feehid and feepro mmr bit designations bit description 31 read protection. this bit is cleared by user code to read protect the 62 kb flash/ee block code. this bit is set by user code to allow read access to the 62 kb flash/ee block via jtag. 30 to 0 write protection bits. when set by user code, these bits unprotect page 0 to page 123 of the 62 kb flash/ee code memory. each bit write protects four pages, and each page consists of 512 bytes. when cleared by user code, these bits write protect page 0 to page 123 of the 62 kb flash/ee code memory. each bit write protects four pages, and ea ch page consists of 512 bytes.
aduc7039 rev. b | page 22 of 92 in summary, there are three levels of protection as follows. temporary protection temporary protection can be set and removed by writing directly into feehid mmr. this register is volatile and, therefore, protection is only in place for as long as the part remains powered on. this protection is not reloaded after a power cycle. keyed permanent protection keyed permanent protection can be set via feepro to lock the protection configuration. the software key used at the start of the required feepro write sequence is saved one time only and must be used for any subsequent access of the feehid or feepro mmrs. a mass erase sets the software protection key back to 0xffff but also erases the entire user code space. permanent protection permanent protection can be set via feepro, similarly to keyed permanent protection, the only difference being that the software key used is 0xdeaddead. when the feepro write sequence is saved, only a mass erase sets the software protection key back to 0xffffffff. this also erases the entire user code space. sequence to write the software protection key and set permanent protection 1. write in feepro corresponding to the pages to be protected. 2. write the new (user-defined) 32-bit software protection key in feeadr (bits[31:16]) and feedat (bits[15:0]). 3. write 1, 0 in feemod (bits[6:5]) and set feemod (bit 3). 4. run the write key command 0x0c in feecon. to remove or modify the protection, the same sequence can be used with a modified value of feepro. the previous sequence for writing the key and setting perma- nent protection is illustrated in the following example, this protects writing page 8 to page 11 of the flash/ee. int a = feesta; // ensure feesta is cleared feepro = 0xfffffffb; // protect page 8 to page 11 feeadr = 0x66bb; // 32-bit key value (bits[31:16]) feedat = 0xaa55; // 32-bit key value (bits 15:0]) feemod = 0x0048 // lock security sequence feecon = 0x0c; // write key command while (feesta & 0x04){} // wait for command to finish
aduc7039 rev. b | page 23 of 92 flash/ee memory reliability the flash/ee memory array on the part is fully qualified for two key flash/ee memory characteristics: flash/ee memory cycling endurance and flash/ee memory data retention. endurance quantifies the ability of the flash/ee memory to be cycled through many program, read, and erase cycles. a single endurance cycle is composed of four independent, sequential events, defined as ? initial page erase sequence. ? read/verify sequence. ? byte program sequence. ? s econd read/verify sequence. in reliability qualification, every half-word (16-bit wide) loca- tion of the three pages (top, middle, and bottom) in the flash/ee memory is cycled 10,000 times from 0x0000 to 0xffff. as indicated in table 1 , the flash/ee memory endurance qualifi- cation of the part is carried out in accordance with the jedec retention lifetime specification a117 . the results allow the specification of a minimum endurance figure over supply and temperature of 10,000 cycles. retention quantifies the ability of the flash/ee memory to retain its programmed data over time. the part is qualified in accordance with the formal jedec retention lifetime specifi- cation a117 at a specific junction temperature (t j = 85c) as indicated in table 1. this means that the flash/ee memory is guaranteed to retain its data for its fully specified retention lifetime every time the flash/ee memory is reprogrammed. also, note that retention lifetime, based on an activation energy of 0.6 ev, derates with t j as shown in figure 8 . 0 150 300 450 600 30 40 55 70 85 100 125 135 150 retention (years) junction temperature (c) 08463-009 figure 8. flash/ee me mory data retention aduc7039 kernel the aduc7039 features an on-chip kernel resident in the top 2 kb of the flash/ee code space. after any reset event, this kernel calculates its own checksum and compares it to the checksum programmed during production test, to ensure that the kernel does not contain any error. if an error occurs, the syschk register contains its default value and user mode is entered. in normal circumstances, the checksum is written to the syschk mmr. system kernel checksum name: syschk address: 0xffff0244 default value: 0x00000000 (updated by kernel at power-on) access: read/write function: at power-on, this 32-bit register holds the kernel checksum. the kernel then copies the factory calibrated data from the manufacturing data space into the various on-chip peripherals. the peripherals calibrated by the kernel are as follows: ? p recision oscillator ? l ow power oscillator ? r eg_avdd/reg_dvdd ? voltage reference ? current adc (offset and gain) ? voltage/temperature adc (offset and gain) processor registers and user registers that can be modified by the kernel and differ from their por default values are as follows: ? r0 to r15 ? gp0con ? syschk ? feeadr/feedat/feecon/feesig ? hvdat/hvcon ? hvcfg ? t2ld the aduc7039 also features an on-chip lin downloader. a flow chart of the execution of the kernel is shown in figure 9 . the current revision of the kernel can be derived from r5, as described in table 65 . after any reset, the watchdog timer is disabled once the kernel code is exited. for the duration of the kernel execution, the watchdog timer is active with a timeout period of 500 ms. this ensures that if an error occurs in the kernel, the aduc7039 automatically resets. if lin download mode is entered, the watchdog is periodically refreshed.
aduc7039 rev. b | page 24 of 92 normal kernel execution time, excluding lin download, is less than 5 ms. it is only possible to enter and leave lin download mode through a reset. sram address 0 to address 0x2b are modified during normal kernel execution, sram address 0xff to address 0x110 are also modified during a lin download. note that even with ntrst = 0, user code is not executed unless address 0x1fc contains either 0x16400000 or the checksum of page 0, excluding address 0x1fc. if address 0x1fc does not contain this information, user code is not executed and lin download mode is entered. during kernel execution, jtag access is disabled. the aduc7039 is delivered with flash user space fully erased and if ntrst = 0 at first power-up, the lin download mode is entered. with ntrst = 1, user code is always executed and jtag is enabled. power down kick wdt try to switch off wdt initialize wdt initialize hv chip copy manid to mmrs reset run user code software reset kernel crc yes ntrst = 1? yes no no yes yes ntrst = 1? multiple crc error? no 0x801fc lin received? yes no 0x801fc = 0x16400000 yes no no 0x801fc = page0 crc? kick wdt handle lin command user reset? no yes reset command? yes no 08463-010 figure 9. aduc7039 kernel flowchart
aduc7039 rev. b | page 25 of 92 memory mapped registers (mmr) the memory mapped register (mmr) space is mapped into the top 4 kb of the mcu memory space and accessed by indirect addressing, load, and store commands through the arm7 banked registers. an outline of the memory mapped register bank for the aduc7039 is shown in figure 10 . the mmr space provides an interface between the cpu and all on-chip peripherals. all registers except the arm7 core registers (described in the arm registers section) reside in the mmr area. as shown in the detailed mmr maps in the complete mmr listing section ( table 14 to tabl e 23 ), the mmr data widths vary from 1 byte (8 bits) to 4 bytes (32 bits). the arm7 core can access any of the mmrs (single byte or multiple byte width registers) with a 32-bit read or write access. the resultant read, for example, is aligned per little endian format as previously described in this data sheet. however, errors result if the arm7 core tries to access 4-byte (32-bit) mmrs with a 16-bit access. in the case of a (16-bit) write access to a 32-bit mmr, the (upper) 16 most significant bits are written as 0s. more obviously, in the case of a 16-bit read access to a 32-bit mmr, only 16 of the mmr bits can be read. interrupt controller 0xffff0110 0xffff0000 remap and system control 0xffff0248 0xffff0220 timer 0 0xffff0310 0xffff0300 wake-up timer 1 0xffff0334 0xffff0320 watchdog timer 2 0xffff0350 0xffff0340 pll and oscillator control 0xffff04a4 0xffff0400 adc 0xffff0560 0xffff0500 lin hardware 0xffff0800 0xffff0700 hv interface 0xffff0810 0xffff0804 spi 0xffff0a14 0xffff0a00 gpio 0xffff0d20 0xffff0d00 flash control interface 0xffff0e24 0xfffffff f 0xffff0e00 08463-011 figure 10. top level mmr map
aduc7039 rev. b | page 26 of 92 complete mmr listing in the following mmr tables, addresses are listed in hex code. access types include r for read, w for write, and rw for read an d write. table 14. irq address base = 0xffff0000 address name byte access type default value description 0x0000 irqsta 4 r 0x00000000 active irq source. 0x0004 irqsig 4 r 0x00003080 current state of all irq sources (enabled and disabled). 0x0008 irqen 4 rw 0x00000000 enabled irq sources. 0x000c irqclr 4 w n/a mmr to disable irq sources. 0x0010 swicfg 4 w n/a software interrupt configuration mmr. 0x0100 fiqsta 4 r 0x00000000 active irq source. 0x0104 fiqsig 4 r 0x00003081 current state of all irq sources (enabled and disabled). 0x0108 fiqen 4 rw 0x00000000 enabled irq sources. 0x010c fiqclr 4 w n/a mmr to disable irq sources. table 15. system control address base = 0xffff0200 address name byte access type default value description 0x0220 sysmap 1 rw n/a remap control register. 0x0230 rststa 1 rw n/a reset status mmr. 0x0234 rstclr 1 w n/a rststa clear mmr. 0x0244 syschk 1 4 rw n/a kernel checksum. see the system kernel checksum section. 1 updated by kernel. table 16. timer address base = 0xffff0300 address name byte access type default value description 0x0300 t0ld 2 rw 0x0000 timer0 load register. 0x0304 t0val 2 r 0x0000 timer0 value register 0. 0x0308 t0con 4 rw 0x0000 timer0 control mmr. 0x030c t0clri 1 w n/a timer0 interrupt clear register. 0x0320 t1ld 4 rw 0x00000000 timer1 load register. 0x0324 t1val 4 r 0xffffffff timer1 value register. 0x0328 t1con 4 rw 0x0000 timer1 control mmr. 0x032c t1clri 1 w n/a timer1 interrupt clear register. 0x0340 t2ld 1 4 rw 0x0050 timer2 load register. 0x0344 t2val 4 r 0x00000050 timer2 value register. 0x0348 t2con 2 rw 0x0000 timer2 control mmr. 0x034c t2clri 1 w n/a timer2 interrupt clear register. 1 updated by kernel.
aduc7039 rev. b | page 27 of 92 table 17. pll base address = 0xffff0400 address name byte access type default value description 0x0400 pllsta 4 r n/a pll status mmr. 0x0404 powkey0 4 w n/a powcon prewrite key. 0x0408 powcon 2 rw 0x079 power control register. 0x040c powkey1 4 w n/a powcon postwrite key. 0x0410 pllkey0 4 w n/a pllcon prewrite key. 0x0414 pllcon 1 rw 0x00 pll clock source selection mmr. 0x0418 pllkey1 4 w n/a pllcon postwrite key. 0x0440 osccon 1 rw 0x00 low power oscillator calibration control mmr. 0x0444 oscsta 1 r 0x00 low power oscillator calibration status mmr. 0x0448 0scval0 2 r 0x0000 low power oscillator calibration counter 0 mmr. 0x044c oscval1 2 r 0x0000 low power oscillator calibration counter 1 mmr. 0x0480 loccon 1 rw 0x00 lin oscillator calibration control register. 0x0484 locusr0 1 rw n/a low power oscillator user trim register. 0x0488 locusr1 2 rw n/a precision oscillator user trim register. 0x048c locmax 3 rw 0x00000 lin oscillator calibration, maximum baud rate tolerance (linbr + x). 0x0490 locmin 3 rw 0x00000 lin oscillator calibratio n, minimum baud rate tolerance (linbr ? x). 0x0494 locsta 1 r 0x01 lin oscillator calibration status register. 0x0498 locval0 1 r n/a low power oscillator current trim value register. 0x049c locval1 2 r n/a precision osci llator current trim value register. 0x04a0 lockey 2 w n/a lin oscillator calibration lock register. table 18. adc address base = 0xffff0500 address name byte access type default value description 0x0500 adcsta 2 r 0x0000 adc status mmr. 0x0504 adcmski 1 rw 0x00 adc interrupt source enable mmr. 0x0508 adcmde 1 rw 0x00 adc mode register. 0x050c adc0con 2 rw 0x0002 current adc control mmr. 0x0510 adc1con 2 rw 0x0000 v/t adc control mmr. 0x0518 adcflt 2 rw 0x0007 adc filter control mmr. 0x051c adccfg 1 rw 0x00 adc configuration mmr. 0x0520 adc0dat 2 r 0x0000 current adc result mmr. 0x0524 adc1dat 2 r 0x0000 v/t adc result mmr. 0x0530 adc0of 1 2 rw n/a current adc offset mmr. 0x0534 adc1of 1 2 rw n/a voltage adc offset mmr. 0x0538 adc2of 1 2 rw n/a temperature adc offset mmr. 0x053c adc0gn 1 2 rw n/a current adc gain mmr. 0x0540 adc1gn 1 2 rw n/a voltage adc gain mmr. 0x0544 adc2gn 1 2 rw n/a temperature adc gain mmr. 0x0548 adc0rcl 2 rw 0x0001 current adc result count limit. 0x054c adc0rcv 2 r 0x0000 current adc result count value. 0x0550 adc0th 2 rw 0x0000 current adc result threshold. 0x055c adc0acc 4 r 0x00000000 current adc result accumulator. 1 updated by kernel.
aduc7039 rev. b | page 28 of 92 table 19. lin base address = 0xffff0700 address name byte access type default value description 0x0700 lincon 2 rw 0x0000 lin control mmr. 0x0704 lincs 1 rw 0xff lin checksum mmr. 0x0708 linbr 3 rw 0x00fa0 19-bit lin baud rate mmr. 0x070c linbk 3 rw 0x0157c 19-bit lin break mmr. 0x0710 linsta 2 r 0x0100 lin status mmr. 0x0714 lindat 1 rw 0x00 lin data mmr. 0x0718 linlow 3 rw 0x00000 lin counter to force the bus low. 0x071c linwu 3 rw 0x00013 lin wake-up break length. table 20. high voltage interface base address = 0xffff0804 address name byte access type default value description 0x0804 hvcon 1 rw n/a high voltage interface control mmr. 0x080c hvdat 1 rw n/a high voltage interface data mmr. table 21. spi base address = 0xffff0a00 address name byte access type default value description 0x0a00 spista 2 r 0x0000 spi status mmr. 0x0a04 spirx 1 r 0x00 spi receive mmr. 0x0a08 spitx 1 w n/a spi transmit mmr. 0x0a0c spidiv 1 r/w 0x00 spi baud rate selection mmr. 0x0a10 spicon 2 r/w 0x0000 spi control mmr. table 22. gpio base address = 0xffff0d00 address name byte access type default value description 0x0d00 gpcon 4 rw 0x00000000 gpio port control mmr. 0x0d10 gpdat 1 4 rw 0x000000ff gpio port data control mmr. 0x0d14 gpset 4 w n/a gpio port data set mmr. 0x0d18 gpclr 4 w n/a gpio port data clear mmr. 1 depends on the level on the external gpio pins. table 23. flash/ee base address = 0xffff0e00 address name byte access type default value description 0x0e00 feesta 2 r 0xxxx0 flash/ee status mmr. 0x0e04 feemod 2 rw 0x0000 flash/ee control mmr. 0x0e08 feecon 1 rw 0x07 flash/ee control mmr. 0x0e0c feedat 2 rw 0x0000 flash/ee data mmr. 0x0e10 feeadr 1 2 rw 0xf009 flash/ee address mmr. 0x0e18 feesig 3 r n/a flash/ee lfsr mmr. 0x0e1c feepro 4 rw 0x00000000 flash/ee protection mmr. 0x0e20 feehid 4 rw 0xffffffff flash/ee protection mmr. 1 updated by kernel.
aduc7039 rev. b | page 29 of 92 16-bit, sigma-delta analog-to-digital converters the aduc7039 incorporates two independent sigma-delta (-) analog-to-digital converters (adcs) namely, the current channel adc (i-adc), and the voltage/temperature channel adc (v/t-adc). these precision measurement channels integrate attenuator, on-chip buffering, a programmable gain amplifier, 16-bit, - modulators, and digital filtering for precise measurement of current, voltage, and temperature variables in 12 v automotive battery systems. current channel adc (i-adc) the i-adc converts battery current sensed through an external 100 ? shunt resistor. on-chip programmable gain means that the i-adc can be configured to accommodate battery current levels from up to 1500 a. as shown in figure 11 , the i-adc employs a - conversion technique to realize 16 bits of no missing codes performance. the - modulator converts the sampled input signal into a digital pulse train whose duty cycle contains the digital infor- mation. a modified sinc3, programmable, low-pass filter is then employed to decimate the modulator output data stream to give a valid 16-bit data conversion result at programmable output rates from 10 hz to 1 khz in normal and low power mode. the i-adc also incorporates a counter, comparator, and accumulator logic. this allows the i-adc result to generate an interrupt after a predefined number of conversions have elapsed or if the i-adc result exceeds a programmable threshold value. once enabled, a 32-bit accumulator automatically sums the 16-bit i-adc results. the time to a first valid (fully settled) result on the current channel is three adc conversion cycles with chop mode turned off and two adc conversion cycles with chop mode turned on. an interrupt can be generated even on unsettled adc samples by enabling the adc continuous interrupt option.
aduc7039 rev. b | page 30 of 92 pga adc threshold adc result output format chop chop analog input diagnostic current sources two 50a iin+ and iin? current sources. analog input diagnostic voltage source vref/136 voltage input. analog input programmable chopping the inputs are alternately reversed through the conversion cycle. - adc the - architecture ensures 16 bits no missing codes. output average as part of the chopping implementation, each data-word output from the filter is summed and averaged with its predecessor. adc accumulator accmulates the adc result. programmable gain amplifier the programmable gain amplifier allows eight bipolar input ranges from 2.3mv to 1.2v (int v ref = +1.2v). - modulator the modulator provides a high frequency 1-bit data stream (the output of which is also chopped) to the digital filter, the duty cycle of which represents the sampled analog input voltage. iin+ iin? vref/136 gnd reg_avdd reg_avdd - adc - modulator programmable digital filter output average offset coefficient gain coefficient adc interrupt adc result accumulator adc result adc result counter adc continuous interrupt adc result counter counts adc results, generates an interrupt on counter overflow. adc interrupt generator generates an adc result from any one of four sources. precision reference the internal 5ppm/c reference is routed to the adc by default. internal reference programmable digital filter the sinc3 filter removes quantization noise introduced by the modulator. the update rate and bandwidth of this filter are programmable via the adcflt mmr. digital comparator the adc result is compared to a preset threshold. output scaling the output word from the digital filter is scaled by the calibration coefficients before being provided as the conversion result. 08463-012 figure 11. current adc, top level overview
aduc7039 rev. b | page 31 of 92 voltage/temperature channel adc (v/t-adc) the voltage/temperature channel adc (v/t-adc) converts additional battery parameters such as voltage and temperature. the input to this channel can be multiplexed from an external voltage and an on-chip temperature sensor. as with the current channel adc described previously, the v/t-adc employs an identical - conversion technique, including a modified sinc3 low-pass filter to give a valid 16-bit data conversion result at programmable output rates from 10 hz to 1 khz. an external rc filter network is not required because this is internally implemented in the voltage channel. the external battery voltage (vbat) is routed to the adc input via an on-chip, high voltage (divide-by-24), resistive attenuator. this adc channel, unlike the current channel, has a fixed input range of 0 v to 28.8 v on vbat. the battery temperature can be derived through the on-chip temperature sensor. by default, the time to a first valid (fully settled) result after an input channel switch on the voltage/temperature channel is three adc conversion cycles with chop mode turned off. a top level overview of the adc signal chain is shown in figure 12 . *r = 66k ? adc result output format chop - adc the - architecture ensures 16 bits no missing codes. output average as part of the chopping implementation, each data-word output from the filter is summed and averaged with its predecessor. - modulator the modulator provides a high frequency 1-bit data stream (the output of which is also chopped) to the digital filter, the duty cycle of which represents the sampled analog input voltage. - adc - modulator programmable digital filter output average offset coefficient gain coefficient precision reference the internal 5ppm/c reference is routed to the adc by default. buf internal temp mux internal reference programmable digital filter the sinc3 filter removes quantization noise introduced by the modulator. the update rate and bandwidth of this filter are programmable via the adc filter mmr. output scaling the output word from the digital filter is scaled by the calibration coefficients before being provided as the conversion result. vbat vtemp 44r* 2r* 2r* differential attenuator divide-by-24, input attenuator buffer amplifiers the buffer amplifiers present a high impedance input stage for the analog input. reg_avdd reg_avdd chop analog input programmable chopping the inputs are alternately reversed through the conversion cycle. analog input diagnostic current sources adc result final (16-bit) adc result. 08463-013 figure 12. voltage/temperature adc, top level overview
aduc7039 rev. b | page 32 of 92 adc ground switch the aduc7039 features an integrated ground switch pin, gnd_sw, pin 9. this switch allows the user to dynamically disconnect ground from external devices and allows a connec- tion to ground using a 20 k resistor, reducing the number of external components required for an ntc circuit as shown in figure 13 . the ground switch feature can be used for reducing power consumption on application specific boards. r ref reg_avdd vtemp ntc 20k ? gnd_sw adccfg[7] 08463-014 figure 13. internal ground switch configuration adc noise performance tables table 24 , table 25 , and table 26 list the output rms noise in microvolts for some typical output update rates on the i- and v/t-adcs. the numbers are typical and are generated at a differential input voltage of 0 v (i-adc), 4v (v-adc) and 0.1 v (t-adc). the output rms noise is specified as the standard deviation (or 1 ) of the distribution of adc output codes collected when the adc input voltage is at a dc voltage. it is expressed as v rms. table 24. current channel adc, normal power mode, typical output rms noise adcflt data update rate adc input range 2.3 mv (512) 37.5 mv (32) 300 mv (4) 1 0x961f 10 hz 0.065 v 0.087 v 0.7 v 0x007f 50 hz 0.144 v 0.170 v 0.7 v 0x0007 1 khz 0.663 v 0.780 v 2.6 v 1 the maximum absolute input voltage allowed is ?200 mv to +300 mv relative to ground. table 25. voltage channel adc, typical output rms noise (referred to adc voltage attenuator input) adcflt data update rate 28.8 v adc input range 0x961f 10 hz 65 v 0x007f 50 hz 65 v 0x0007 1 khz 180 v table 26. temperature channel ad c, typical output rms noise adcflt data update rate 0 v to 1.2 v adc input range 0x961f 10 hz 2.8 v 0x007f 50 hz 2.8 v 0x0007 1 khz 7.5 v
aduc7039 rev. b | page 33 of 92 adc mmr interface the adc is controlled and configured through a number of mmrs that are described in detail in the following sections. all bits defined in the top eight msbs (bits[15:8]) of the adcsta mmr are used as flags only and do not generate interrupts. all bits defined in the lower eight lsbs (bits[7:0]) of this mmr are logic ored to produce a single adc interrupt to the mcu core. in response to an adc interrupt, user code should interrogate the adcsta mmr to determine the source of the interrupt. each adc interrupt source can be individually masked via the adcmski mmr described in the adc interrupt mask register section. all adc result ready bits are cleared by a read of the adc0dat mmr. if the current channel adc is not enabled, all adc result ready bits are cleared by a read of the adc1dat mmr. to ensure that i-adc and v/t-adc conversion data are syn- chronous, user code should first read the adc1dat mmr and then adc0dat mmr. new adc conversion results are not written to the adcxdat mmrs unless the respective adc result ready bits are first cleared. the only exception to this rule is when the arm core is powered down and the adc subsystem is active. in this mode, adcxdat registers always contain the most recent adc conversion result even though the ready bits have not been cleared. adc status register name: adcsta address: 0xffff0500 default value: 0x0000 access: read only function: this read-only register holds general status information related to the mode of operation or current status of the adcs. table 27. adcsta mmr bit designations bit description 15 adc calibration status. this bit is set automatically in hardware to indicate an adc calibration cycle has been completed. this bit is cleared automatically after any of the followi ng registers are written to: adcmde, adcflt, or adc0con. 14 reserved. 13 adc voltage/temperature conversion error. this bit is set automatically in hardware to indicate that a voltage conversion overrange or underrange has occurred. the conversion result is clamped to negative full scale (underrange error) or positive full scale (overrange error) in this case. this bit is cleared automatically when a valid (in-range) vo ltage conversion result is written to the adc1dat register. 12 adc current conversion error. this bit is set automatically in hardware to indicate that a current conversion overrange or underrange has occurred. the conversion result is clamped to negative full scale (underrange error) or positive full scale (overrange error) in this case. this bit is cleared automatically when a valid (in-range) cu rrent conversion result is written to the adc0dat register. 11 to 6 not used. these bits are reserved for future fu nctionality and should not be monitored by user code. 5 adc continuous interrupt bit. this bit is set automatically after each i-adc conversion. results of the adcs might not be valid. this bit is only active if e nabled in the adcmde mmr. this bit is cleared when user code reads adc0dat. 4 current channel adc comparator threshold. this bit is only valid if the current channel adc comparator is enabled via the adccfg mmr. this bit is set by hardware if the absolute value of the i-ad c conversion result exceeds the va lue written in the adc0th mmr. this bit is cleared automatically by hardware when reconfiguring the adc. 3 reserved. 2 temperature conversion result ready bit. if the temperature channel adc is enabled, this bit is set by ha rdware as soon as a valid temperature conversion result is writ ten in the temperature data register (adc1dat mmr). it is also set at the end of a calibration. this bit is cleared when user code reads either adc1dat or adc0dat. 1 voltage conversion result ready bit. if the voltage channel adc is enabled, this bit is set by hardware as soon as a valid voltage conversion result is written in t he voltage data register (adc1dat mmr). it is also set at the end of a calibration. this bit is cleared when user code reads either adc1dat or adc0dat. 0 current conversion result ready bit. if the current channel adc is enabled, this bit is set by hardware as soon as a valid current conversion result is written in t he current data register (adc0dat mmr). it is also set at the end of a calibration. this bit is cleared when user code reads adc0dat.
aduc7039 rev. b | page 34 of 92 adc interrupt mask register name: adcmski address: 0xffff0504 default value: 0x00 access: read/write function: this register allows the adc interrupt sources to be individually enabled. the bit positions in this register are the same as the lower eight bits in the adcsta mmr. if a bit is set by user code to a 1, the respective interrupt is enabled. by default, all bits are 0, meaning all adc interrupt sources are disabled. note that adcmski[2:0] should not be set if adcmski[5] is set. adc mode register name: adcmde address: 0xffff0508 default value: 0x00 access: read/write function: the adc mode mmr is an 8-bit register that configures the mode of operation of the adc subsystem. table 28. adcmde mmr bit designations bit description 7 to 6 not used. these bits are reserved for future functionality and should be written as 0 by user code. 5 adc enable continuous interrupt. this bit is set to 1 to enable adcsta[5]. this bit is set to 0 by default. 4 reserved. 3 adc power mode configuration. 0 = adc normal mode. if enabled, the adc operates with normal current consumption yielding optimum electrical performance. 1 = adc low power mode. if enabled, the adc operates with reduce d current consumption. in this mode, the gain is fixed to 512. 2 to 0 adc operation mode configuration. 0, 0, 0 = adc power-down mode. all adc circuits are powered down. 0, 0, 1 = adc continuous conversion mode. in this mode, any enabled adc continuously converts. 0, 1, 0 = adc single conversion mode. in this mode, any enabled adc performs a single conversion. the adc enters idle mode when the single shot conversion is complete. a single conversion takes two to three adc clock cycles depending on the chop mode. 0, 1, 1 = adc idle mode. in this mode, the ad c is fully powered on but is held in reset. 1, 1, 0 = adc system zero-scale calibration. in this mode, a ze ro-scale calibration is performed on enabled adc channels agains t an external zero-scale voltage applied to the adc input pins. th e calibration is carried out at the user programmed adc setting s; therefore, as with a normal, single adc conversion, it takes th e full adc filter settling time before a fully settled calibrati on result is ready. the results (offset coefficients) are available in the adcxda t mmr when adcsta[15] is set. user software should copy the result of the conversion to the adcxof mmr. 1, 1, 1 = adc system full-scale calibration. in this mode, a full-scale calibration is performed on enabled adc channels agains t an external full-scale voltage applied to the adc input pins. the re sults (gain coefficients) are available in the adcxdat mmr whe n adcsta[15] is set. user software should copy th e result of the conversion to the adcxgn mmr. other = reserved.
aduc7039 rev. b | page 35 of 92 current channel adc control register name: adc0con address: 0xffff050c default value: 0x0002 access: read/write function: the current channel adc control mmr is a 16-bit register that is used to configure the i-adc. note: if the current adc is reconfigured via adc0con, the voltage/temperature adc is also reset. table 29. adc0con mmr bit designations bit description 15 current channel adc enable. this bit is set by user code to enable the i-adc. this bit is cleared by user code power-down the i-adc and re sets the respective adc ready bit in the adcsta mmr to 0. 14 to 13 iin current source enable. 00 = current sources off. 01 = enables 50 a current source on iin+. 10 = enables 50 a current source on iin?. 11 = enables 50 a current source on both iin? and iin+. 12 to 10 not used. these bits are reserved for futu re functionality and should be written as zero. 9 current channel adc output coding. this bit is set by user code to co nfigure i-adc output coding as unipolar. this bit is cleared by user code to conf igure i-adc output coding as twos complement. 8 not used. this bit is reserved for future fu nctionality and should be written as zero. 7 to 6 current channel adc input select. 00 = iin+, iin?. 01 = iin?, iin? = diagnostic, internal short configuration. 10 = vref/136, 0 v, diagnostic, test voltage for gain settings <512. if the (reg_avdd, agnd) divided-by-two reference is select ed, reg_avdd is used instead of vref with this i-adc inp ut selection. this leads to adc0dat scaled by two. 11 = not defined. 5 reserved. 4 current channel adc reference select. 0 = internal, 1.2 v precision reference selected. 1 = (reg_avdd, agnd) divided-by-two selected. 3 to 0 current channel adc gain select. note: nominal i-adc full-scale input voltage = (vref/gain). 0001 = i-adc gain of 2. this setting is tested for functionality only; therefore, it does not appear in the electrical specifi cations. 0010 = i-adc gain of 4. 0011 = i-adc gain of 8. 0100 = i-adc gain of 16. 0101 = i-adc gain of 32. 0110 = i-adc gain of 64. 0111 = i-adc gain of 128. 1000 = i-adc gain of 256. 1001 = i-adc gain of 512. other = i-adc gain is undefined.
aduc7039 rev. b | page 36 of 92 voltage/temperature channel adc control register name: adc1con address: 0xffff0510 default value: 0x0000 access: read/write function: the voltage/temperature channel adc control mmr is a 16-bit register that is used to configure the v/t-adc. if both adcs are being reconfigured, adc1con should be written before adc0con to ensure both adcs start synchronously. if adc0 is already on and converting and adc1 is off, then, first turn on adc1 and second disable, and re-enable adc0 so that the two adcs start simultaneously (this accounts for adc start-up time). table 30. adc1con mmr bit designations bit description 15 voltage/temperature channel adc enable. this bit is set to 1 by user code to enable the v/t-adc. clearing this bit to 0 powers down the v/t-adc. 14 to 13 vtemp current source enable. 0, 0 = current sources off. 0, 1 = enables 50 a current source on vtemp. 1, 0 = enables 50 a current source on gnd_sw. 1, 1 = enables 50 a current source on both vtemp and gnd_sw. 12 to 10 not used. these bits are reserved for future fu nctionality and should not be modified by user code. 9 voltage/temperature channel adc output coding. this bit is set to 1 by user code to co nfigure v/t-adc output coding as unipolar. this bit is cleared to 0 by user code to co nfigure v/t-adc output coding as twos complement. 8 not used. this bit is reserved for future function ality and should be written as 0 by user code. 7 to 6 voltage/temperature channel adc input select. 0, 0 = vbat/24, agnd. vbat attenuator selected. 0, 1 = vtemp, gnd_sw. external temperature input selected, conversion result written to adc1dat. 1, 0 = internal sensor. internal temperature sensor input selected, conversion result written to adc1dat. the temperature gradient is 0.33 mv/c; this is only applicable to the internal temperature sensor. 1, 1 = internal short. shorted input. 5 not used. this bit is reserved for future function ality and should be written as 0 by user code. 4 voltage/temperature channel adc reference select. 0 = internal, 1.2 v precision reference selected. 1 = (reg_avdd, gnd_sw)/2 selected. 3 to 0 not used. these bits are reserved for future func tionality and should not be written as 0 by user code.
aduc7039 rev. b | page 37 of 92 adc filter register name: adcflt address: 0xffff0518 default value: 0x0007 access: read/write function: the adc filter mmr is a 16-bit register that controls the speed and resolution of the on-chip adcs. note: if adcflt is modified, the current and voltage/temperature adcs are reset. it is recommended that all bits of this mmr are written in a single write operation. table 31. adcflt mmr bit designations bit description 15 chop enable. this bit is set by the user to enable system chopping of all active adcs. when this bit is set, the adc has very low offset errors and drift, but the adc output rate is reduced by a factor of three if af = 0 (see sinc3 decimation factor, bits[6:0] in this table). if af > 0, then the adc o utput update rate is the same with chop on or off. when chop is enabled, the settling time is two output periods. 14 running average. this bit is set by the user to enable a running-average-by-two function reducing adc noise. this function is automatically enabled when chopping is active. it is an optional feature when chopping is inactive, an d if enabled (when chopping is inactive) does not reduce the adc output rate but does increase the settl ing time by one conversion period. this bit is cleared by the user to disable the running average function. 13 to 8 averaging factor (af). the values written to these bits are used to implement a pr ogrammable first-order sinc3 postfilter. the averaging factor can further reduce adc noise at the expense of the output rate as described in bits[6:0] sinc 3 decimation factor in this table. 7 sinc3 modify. this bit is set by the user to modify th e standard sinc3 frequency response to increase the filter stop-band rejection by approximately 5 db. this is achieved by inserting a second notch (notch2) at f notch2 = 1.333 f notch where f notch is the location of the first notch in the response. 6 to 0 sinc3 decimation factor (sf) 1 . the value (sf) written in these bits controls the oversampli ng (decimation factor) of the sinc3 filter. the output rate from the sinc3 filter is given by f adc = (512,000/([ sf + 1] 64)) hz when the chop bit (bit 15, chop enable) = 0 and the averaging factor (af) = 0. this is valid for all sf values 125. for sf = 126, f adc is forced to 60 hz. for sf = 127, f adc is forced to 50 hz. for information on calculating the f adc for sf (other than 126 and 127) and af values, refer to table 32 . 1 due to limitations on the digital filter internal data path, th ere are some limitations on the combinations of the sinc3 decim ation factor (sf) and averaging factor (af) that can be used to generate a required adc output rate. this restrict ion limits the minimum ad c update to 10 hz.
aduc7039 rev. b | page 38 of 92 table 32. adc conversion rates and settling times chop enabled averaging factor running average f adc t settling 1 no no no 64]1[ 000,512 + adc f 3 no no yes 64]1[ 000,512 + adc f 4 no yes no ]3[64]1[ 000,512 af sf ++ adc f 1 no yes yes ]3[64]1[ 000,512 af sf ++ adc f 2 yes n/a n/a 3]3[64]1[ 000,512 +++ adc f 2 1 an additional time of approximately 60 s per adc is required before the firs t adc result is available. table 33. allowable combinations of sf and af af range sf 0 1 to 7 8 to 63 0 to 31 yes yes yes 32 to 63 yes yes no 64 to 127 yes no no
aduc7039 rev. b | page 39 of 92 adc configuration register name: adccfg address: 0xffff051c default value: 0x00 access: read/write function: the 8-bit adc configuration mmr controls extended functionality related to the on-chip adcs. table 34. adccfg mmr bit designations bit description 7 analog ground switch enable. this bit is set to 1 by user software to connect the external gnd_sw pin (pin 9) to an internal 20 k resistor to ground. this bit can be used to connect and disconnect external ci rcuits and components to ground under program control and thereby minimize dc current consumption when the ex ternal circuit or component is not being used. 6 to 5 not used. these bits are reserved for future fu nctionality and should not be modified by user code. 4 current channel adc accumulator enable. 0 = accumulator disabled and reset to 0. the accumulator mu st be disabled for a full adc conversion (adcsta[0] set twice) before the accumulator can be re-enabled to ensure the accumulator is reset. 1 = accumulator enabled. 3 current channel adc comparator enable. 0 = comparator disabled. 1 = comparator active, interrupt asserted if absolute value of i-adc conversion result |i| adc0th. 2 not used. this bit is reserved for future function ality and should be written as 0 by user code. 1 fast temperature sensor mode. this bit is set by the user to en able the feature described in the fast temperature conversion mode section. when this bit is set, adc1con[7:6] is temporarily ignored to produce a single fully settled result of the internal temperature sensor. this fast conversion mode is applicable to the internal temperature sensor only. this bit should be cleared by the user when the fast conversion is complete. 0 current channel adc, result counter enable. this bit is set by the user to enable the result count mode . in this mode, an i-adc interrupt is generated only when adc0rcv = adc0rcl. this allows the i-adc to continuously monitor current but only interrupt the mcu core after a defined number of conversions. the voltage/temperature adc also continues to convert if enabled, but again, only the last conversion result is available (intermediate v/t-adc conversion results are not stored) when the adc counter interrupt occurs. current channel adc data register name: adc0dat address: 0xffff0520 default value: 0x0000 access: read only function: this adc data mmr holds the 16-bit conver- sion result from the i-adc. the adc does not update this mmr if the adc0 conversion result ready bit (adcsta[0]) is set. a read of this mmr by the mcu clears all asserted ready flags (adcsta[2:0] and adcsta[5]). voltage/temperature channel adc data register name: adc1dat address: 0xffff0524 default value: 0x0000 access: read only function: this adc data mmr holds the 16-bit voltage (or temperature) conversion result from the v/t-adc. the adc does not update this mmr if the voltage (or temperature) conversion result ready bit (adcsta[1] or adcsta[2]) is set. if i-adc is not active, a read of this mmr by the mcu clears all asserted ready flags (adcsta[2:1] and adcsta[5]).
aduc7039 rev. b | page 40 of 92 current channel adc offset calibration register name: adc0of address: 0xffff0530 default value: part specific, factory programmed access: read/write function: this adc offset mmr holds a 16-bit offset calibration coefficient for the i-adc. the register is configured at power-on with a factory default value. however, user code can overwrite this default value with the result of an offset calibration contained in adc0dat after performing a calibration via adcmde[2:0]. voltage channel adc offset calibration register name: adc1of address: 0xffff0534 default value: part specific, factory programmed access: read/write function: this adc offset mmr holds a 16-bit offset calibration coefficient for the voltage channel. the register is configured at power-on with a factory default value. however, user code can overwrite this default value with the result of an offset calibration contained in adc1dat after performing a calibration via adcmde[2:0]. temperature channel adc offset calibration register name: adc2of address: 0xffff0538 default value: part specific, factory programmed access: read/write function: this adc offset mmr holds a 16-bit offset calibration coefficient for the temperature channel. the register is configured at power- on with a factory default value. however, user code can overwrite this default value with the result of an offset calibration contained in adc1dat after performing a calibration via adcmde[2:0]. current channel adc gain calibration register name: adc0gn address: 0xffff053c default value: part specific, factory programmed access: read/write function: this gain mmr holds a 16-bit gain calibration coefficient for scaling the i-adc conversion result. the register is configured at power-on with a factory default value. however, user code can overwrite this default value with the result of a gain calibration contained in adc0dat after performing a calibration via adcmde[2:0]. voltage channel gain calibration register name: adc1gn address: 0xffff0540 default value: part specific, factory programmed access: read/write function: this gain mmr holds a 16-bit gain calibration coefficient for scaling a voltage channel con- version result. the register is configured at power-on with a factory default value. however, user code can overwrite this default value with the result of a gain calibration contained in adc1dat after performing a calibration via adcmde[2:0]. temperature channel gain calibration register name: adc2gn address: 0xffff0544 default value: part specific, factory programmed access: read/write function: this gain mmr holds a 16-bit gain calibration coefficient for scaling a temperature channel conversion result. the register is configured at power-on with a factory default value.
aduc7039 rev. b | page 41 of 92 current channel adc result counter limit register name: adc0rcl address: 0xffff0548 default value: 0x0001 access: read/write function: this 16-bit mmr sets the number of conver- sions required before an adc interrupt is generated. by default, this register is set to 0x01. the adc counter function must be enabled via the adc result counter enable bit in the adccfg mmr. current channel adc result count register name: adc0rcv address: 0xffff054c default value: 0x0000 access: read only function: this 16-bit, read-only mmr holds the current number of i-adc conversion results. it is used in conjunction with adc0rcl to mask i-adc interrupts, generating a lower interrupt rate. when adc0rcv = adc0rcl, the value in adc0rcv resets to 0 and recommences counting. it can also be used in conjunction with the accumulator (adc0acc) to allow an average current calculation to be undertaken. the result counter is enabled via adccfg[0]. this mmr is also reset to 0 when the i-adc is reconfigured, that is, when the adc0con or adcmde are written. current channel adc threshold register name: adc0th address: 0xffff0550 default value: 0x0000 access: read/write function: this 16-bit mmr sets the threshold against which the absolute value of the i-adc conversion result is compared. in unipolar mode, adc0th[15:0] are compared and in twos complement mode, adc0th[14:0] are compared. current channel adc accumulator register name: adc0acc address: 0xffff055c default value: 0x00000000 access: read only function: this 32-bit mmr holds the current accumulator value. the i-adc ready bit in the adcsta mmr should be used to determine when it is safe to read this mmr. the mmr value is reset to 0 by disabling the accumulator in the adccfg mmr or reconfiguring the current channel adc.
aduc7039 rev. b | page 42 of 92 adc sinc3 digital filter response the overall frequency response on all aduc7039 adcs is dominated by the low-pass filter response of the on-chip sinc3 digital filters. the sinc3 filters are used to decimate the adc - modulator output data bit stream to generate a valid 16-bit data result. the digital filter response is identical for both adcs and is configured via the 16-bit adc filter (adcflt) register. this register determines the overall throughput rate of the adcs. the noise resolution of the adcs is determined by the programmed adc throughput rate. in the case of the current channel adc, the noise resolution is determined by throughput rate and selected gain. the overall frequency response and the adc throughput is dominated by the configuration of the sinc3 filter decimation factor (sf) bits (adcflt[6:0]) and the averaging factor (af) bits (adcflt[13:8]). due to limitations on the digital filter internal data path, there are some limitations on the allowable combinations of sf and af that can be used to generate a required adc output rate. this restriction limits the minimum adc update in normal power mode to 10 hz. the calculation of the adc throughput rate is detailed in the adcflt bit designations table and the restrictions on allowable combi- nations of af and sf values are outlined in table 33 . by default, the adcflt = 0x0007 configures the adcs for a throughput of 1.0 khz with all other filtering options (chop, running average, averaging factor, and sinc3 modify) disabled. a typical filter response based on this default configuration is shown in figure 14 . ?100 0 ?10 ?20 ?30 ?40 ?50 ?60 ?70 ?80 ?90 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 (db) frequency (hz) 08463-015 figure 14. typical digital filter response at f adc = 1.0 khz (adcflt = 0x0007) an additional sinc3 modify bit (adcflt[7]) is also available in the adcflt register. this bit is set by user code to modify the standard sinc3 frequency response increasing the filter stop- band rejection by approximately 5 db. this is achieved by inserting a second notch (notch2) at f notch2 = 1.333 f notch where f notch is the location of the first notch in the response. there is a slight increase in adc noise if this bit is active. figure 15 shows the modified 1 khz filter response when the sinc3 modify bit is active. the new notch is clearly visible at 1.33 khz, as is the improvement in stop-band rejection when compared to the standard 1 khz response. (db) frequency (khz) ?100 0 ?10 ?20 ?30 ?40 ?50 ?60 ?70 ?80 ?90 0 0.5 1.5 2.5 3.5 4.0 4.5 3.0 2.0 1.0 5.0 08463-016 figure 15. modified sinc3 di gital filter response at f adc = 1.0 khz (adcflt = 0x0087) at very low throughput rates, the chop bit in the adcflt register can be enabled to minimize offset errors and, more importantly, temperature drift in the adc offset error. there are two primary variables (sinc3 decimation factor and averaging factor) available to allow the user to select an optimum filter response, trading off filter bandwidth against adc noise. for example, with the chop bit (adcflt[15]) set to 1, increasing the sf value (adcflt[6:0]) to 0x1f (31 decimal) and selecting an af value (adcflt[13:8]) of 0x16 (22 decimal) results in an adc throughput of 10 hz. the frequency response in this case is shown in figure 16 . ?100 0 ?10 ?20 ?30 ?40 ?50 ?60 ?70 ?80 ?90 02 180160140120100 8060 4020 (db) frequency (hz) 0 0 08463-017 figure 16. typical digital filter response at f adc = 10 hz, (adcflt = 0x961f)
aduc7039 rev. b | page 43 of 92 in adc low power mode, the adc, - modulator clock is no longer driven at 512 khz but is driven directly from the on-chip low power (128 khz) oscillator. subsequently, for the same adcflt configurations in normal mode, all filter values should be scaled by a factor of approximately four. in general, it is possible to program different values of sf and af in the adcflt register and achieve the same adc update rate. in practical terms, the trade off with any value of adcflt is frequency response vs. adc noise. for optimum filter response and adc noise when using combinations of sf and af, best practice suggests choosing an sf in the range of 16 decimal to 40 decimal, or 0x10 to 0x28, and then increasing the af value to achieve the required adc throughput. table 35 shows some common adcflt configurations. adc modes of operation the adcs can be configured into reduced (low power) or full power (normal) mode of operation by configuring adcmde[3] as appropriate. the arm7 mcu can also be configured in low power modes of operation (powcon[5:3]). the core power modes are independently controlled and are not related to the adc power modes described in this section. adc normal power mode in normal mode, the current and voltage/temperature channels are fully enabled. the adc modulator clock is 512 khz and enables the adcs to provide regular conversion results at a rate of between 10 hz and 1 khz (see the adc filter register section). both channels are under full control of the mcu and can be reconfigured at any time. the default adc update rate for all channels in this mode is 1.0 khz. it is worth emphasizing that i-adc and v/t-adc channels can be configured to initiate periodic, normal power mode, high accuracy, single conversion cycles before returning to adc full power-down mode. this flexibility is facilitated under full mcu control via the adcmde mmr; it ensures that continuous peri- odic monitoring of battery current, voltage, and temperature settings is feasible while ensuring the average dc current consumption is minimized. in adc normal mode, the pll must not be powered down. adc low power mode in adc low power mode, the i-adc is enabled in a reduced power and reduced accuracy configuration. the adc modu- lator clock is now driven directly from the on-chip 128 khz low power oscillator. the gain of the adc in this mode is fixed at 512. all of the adc peripheral functions (result counter, digital comparator and accumulator) can be enabled in low power mode. typically, in low power mode, the i-adc only, is configured to run at a low update rate, continuously monitoring battery current. the mcu is in power-down mode and wakes up when the i-adc interrupts the mcu. this happens after the i-adc detects a current conversion beyond a preprogrammed thre- shold, setpoint, or a set number of conversions. adc comparator and accumulator every i-adc result can also be compared to a preset threshold level (adc0th) as configured via adccfg[3]. an mcu interrupt is generated if the absolute (sign independent) value of the adc result is greater than the preprogrammed com- parator threshold level. finally, a 32-bit accumulator (adc0acc) function can be configured (adccfg[5]) allowing the i-adc to add (or subtract) multiple i-adc sample results. user code can read the accumulated value directly (adc0acc) without any further software processing. adc continuous interrupt mode setting adcmde[5] allows the user to generate an adc interrupt after each adc conversion period, even if the adc filter is not fully settled. the corresponding adc interrupt bit in the adcmski must also be set to allow the continuous interrupt. in this mode of operation, adcsta[2:0] are used as valid flags and should not be used to generate interrupts. table 35. common adcflt configurations adc mode sf af other config. adcflt f adc t settle normal 0x1f 0x16 chop on 0x961f 10 hz 0.2 sec normal 0x07 0x00 none 0x0007 1 khz 3 ms normal 0x07 0x00 sinc3 modify 0x0087 1 khz 3 ms low power 0x10 0x03 chop on 0x8310 20 hz 100 ms low power 0x10 0x09 chop on 0x8910 10 hz 200 ms
aduc7039 rev. b | page 44 of 92 adc calibration as shown in detail in the top level diagrams ( figure 11 and figure 12 ), the signal flow through all adc channels can be described in the following steps: 1. an input voltage is applied through an input buffer (and pga in the case of the i-adc) to the - modulator. 2. the modulator output is applied to a programmable digital decimation filter. 3. the filter output result is then averaged if chopping is used. 4. an offset value (adcxof) is subtracted from the result. 5. this result is scaled by a gain value (adcxgn). 6. finally, the result is formatted as twos complement/ unipolar, rounded to 16 bits, or clamped to full scale. each adc channel (current, voltage, and temperature) has a specific offset and gain correction or calibration coefficient associated with it that are stored in mmr-based offset and gain registers (adcxof and adcxgn). the offset and gain registers can be used to remove system level offset and gain errors external to the part. these registers are configured at power-on with a factory programmed calibration value. these factory calibration values vary from part to part reflecting the manufacturing variability of internal adc circuits. these registers can also be overwritten by user code after a calibration. on the current channel when a system calibration is initiated, the adc generates its calibration coefficient based on an externally generated zero-scale voltage and full-scale voltage, which are applied to the external adc input for the duration of the calibration cycle. the coefficients are written in the adc0dat mmr of the adc channels; they are not auto- matically written in the adc0of or adc0gn mmr. user code must copy these values to their appropriate registers. the duration of an offset calibration is a full adc filter settling time before returning the adc to idle mode. when a calibra- tion cycle is initiated, any ongoing adc conversion is immediately halted, the calibration is automatically carried out at an adc update rate programmed into adcflt, and the adc is always returned to idle after any calibration cycle. it is strongly recom- mended that adc calibration is initiated at as low an adc update rate as possible (high sf value in adcflt) to minimize the impact of adc noise during calibration. on the voltage channel, a two-point calibration must be per- formed as the minimum voltage specified on the input is 4 v. the temperature channel is factory calibrated for the internal temperature sensor. calibrating the voltage channel to calibrate the offset and gain of the voltage channel a two- point calibration method must be used. this method consists of converting two known voltages (for example, 8 v and 16 v) to determine lope and offset of the transfer function. the gain coefficient can be divided by the calculated slope to improve the gain error. the offset error can be reduced by writing ? of the calculated offset (in unipolar codes) into the adc1of mmr. calibrating the current channel if the chop bit (adcflt[15]) is enabled, then internal adc offset errors are minimized and an offset calibration may not be required. if chopping is disabled, however, an initial offset calibration is required and may need to be repeated, particularly after a large change in temperature. a gain calibration, particularly in the context of the i-adc (with internal pga), may need to be carried out at all relevant system gain ranges depending on system accuracy requirements. if it is not possible to apply an external full-scale current on all gain ranges, then it is possible to apply a lower current and scale the result produced by the calibration. for example, apply a 50% current and then divide the adc0dat value produced-by-two and write this value back into adc0gn. note that there is a lower limit to the input signal that can be applied for a system calibration because adc0gn is only a 16-bit register. the input span (difference between the system zero-scale value and system full-scale value) should be greater than 40% of the nominal full-scale-input range, that is, >40% of v ref /gain. the on-chip flash/ee memory can be used to store multiple calibration coefficients. these can be copied by user code directly into the relevant calibration registers, as appropriate, based on the system configuration. a factory, or end-of-line calibration, for the i-adc is a two- step procedure. 1. apply the 0 a current. configure the adc in the required pga setting, and so on, and write to adcmde[2:0] to perform a system zero-scale calibration. this writes a new offset calibration value into adc0dat. user code must store this value into adc0of or into flash/ee memory. 2. apply a full-scale current for the selected pga setting. write to adcmde to perform a system full-scale cali- bration. this writes a new gain calibration value into adc0dat. this value must be copied by user software to the adc0gn mmr or into flash/ee memory.
aduc7039 rev. b | page 45 of 92 understanding the offset and gain calibration registers the output of the average block in the adc signal flow can be considered a fractional number with a span for a full-scale input of approximately 0.75. the span is less than 1.0 because there is attenuation in the modulator to accommodate some overrange capacity on the input signal. the exact value of the attenuation varies slightly from part-to-part because of manufacturing tolerances. the offset coefficient is read from the adc0of calibration register. this value is a 16-bit, twos complement number. the range of this number, in terms of the signal chain, is effectively 1.0. therefore, 1 lsb of the adc0of register is not the same as 1 lsb of adc0dat. a positive value of adc0of indicates that when offset is subtracted from the output of the filter, a negative value is added. the nominal value of this register is 0x0000, indicating zero offset is to be removed. the actual offset of the adc can vary slightly from part-to-part and at different pga gains. the offset within the adc is minimized if the chopping mode is active (adcflt[15] = 1). the gain coefficient is a unitless scaling factor. the 16-bit value in this register is divided by 16,384 and then multiplied by the offset corrected value. the nominal value of this register equals 0x5555, corresponding to a multiplication factor of 1.3333. this scales the nominal 0.75 signal to produce a full-scale output signal of 1.0 which is checked for overflow/underflow and converted to twos complement or unipolar mode, as appro- priate, before being output to the data register. the actual gain, and the required scaling coefficient for zero gain error, varies slightly from part to part and at different pga settings. the value downloaded into adc0gn at power-on- reset represents the scaling factor for a pga gain = 4. there is some level of gain error if this value is used at different pga settings. user code can run adc calibrations and overwrite the calibration coefficients to correct the gain error at the current pga setting. in summary, the simplified adc transfer function can be described as nom ref in out adcgn adcgn adcof v pgav adc ? ? ? ? ? ? ? = this equation is valid for the voltage/temperature channel adc. for the current channel adc, nom ref in out adcgn adcgn adcofk v pgav adc ? = ? ? ? ? ? ? where k is dependent on the pga gain setting and adc mode. for pga gains of 4 and 32, the k factor is 1. for a pga gain of 512, the k factor is 8. adc configuration fast temperature conversion mode the battery temperature can be derived through the on-chip temperature sensor. by default, the time to a first valid (fully settled) result after switching the adc input from the voltage to the temperature channel or from the temperature to the voltage channel is three adc conversion cycles with chop mode turned off as shown in figure 17 . valid v/t conversion v/t-adc sampling i-adc sampling i-adc interrupt vv t vvv vvv ttt 08463-031 channel switching request figure 17. default temperature mode, chop off a fast mode is provided on the temperature channel to minimize the switching delay between voltage conversion and temperature conversions as shown in figure 18 and in table 36 . v vvvvv t valid v/t conversion v/t-adc sampling i-adc sampling i-adc interrupt v v v v v v v v v v 08463-032 c hannel switching request figure 18. fast temperature mode, chop off ( adcflt = 0x07) a request for a fast temperature conversion is executed with a delay of one adc conversion. the fast temperature mode must be cleared after the temperature measurement is available but before a new temperature request. table 36. fast temperature mode interrupt valid flags user code 1 i and v voltage = adc1dat. 2 i and v voltage = adc1dat. set fast temperature request bit. 3 i and v voltage = adc1dat. this data must be read for the next temperature channel flag to be valid. 4 i and t temperature = adc1dat. clear fast temperature request bit. 5 i 6 i 7 i and v voltage = adc1dat. 8 i and v voltage = adc1dat.
aduc7039 rev. b | page 46 of 92 the fast temperature option cannot be used on the first con- version after adc power-on. it can only be set after at least the first adc interrupt. waiting for a valid adc result is not necessary. also, a restriction when using the fast tempera- ture mode is to ensure that sf >=1. in addition, a conversion rate of 1 ms is recommended in this mode of operation. this is to ensure the fast result occurs simultaneously with the current channel result. when changing the adcs configuration, by writing adcmde, adc0con or adcflt, the fast temperature bit must also be cleared to ensure correct operation. this condition is similar to a first conversion after adc power-on. i-adc diagnostics the aduc7039 features the capability to detect open-circuit conditions on the application board. this is accomplished using the two current sources on iin+ and iin?; these are controlled via adc0con[14:13]. note that these current sources have a tolerance of 30%.
aduc7039 rev. b | page 47 of 92 power supply support circuits the aduc7039 integrates two on-chip, low dropout (ldo) regulators that are driven directly from the battery voltage to generate a 2.6 v internal supply. this 2.6 v supply is then used as the supply voltage for the arm7 mcu and peripherals including the precision analog circuits on-chip. the digital ldo functions with two external capacitors in parallel, on reg_dvdd, whereas, the analog ldo functions with an external capacitor (0.47 f) on reg_avdd. the esr of the output capacitor affects stability of the ldo control loop. an esr of 5 or less for frequencies above 32 khz is recommended to ensure the stability of the regulators. power-on-reset (por), and low voltage flag (lvf) functions are also integrated to ensure safe operation of the mcu as well as continuous monitoring of the battery power supply. the por circuit is designed to operate with a vdd power-on time (0 v to 12 v), of greater than 100 s. it is, therefore, recommended to carefully select external power supply decoupling compo- nents to ensure that the vdd supply, power-on time, can always be guaranteed to be greater than 100 s. the series resistor and decoupling capacitor combination on vdd should be chosen to ensure an rc time constant of at least 100 s, for example 10 and 10 f as shown in figure 33 . as shown in figure 19 , once the supply voltage (on vdd), reaches a minimum operating voltage of 3 v, a por signal keeps the arm core in reset for 20 ms. this ensures that the regulated power supply voltage (reg_dvdd) supplied to the arm core and associated peripherals, is above the minimum operational voltage to guarantee full functionality. a por flag is set in the rststa mmr to indicate a por reset event has occurred. at voltages below the por level, an additional low voltage flag can be enabled (hvcfg[2]). it can be used to indicate that the contents of the sram remain valid after a reset event. the operation of the low voltage flag is shown in figure 19 . when enabled, the status of this bit can be monitored via hvsta[2]. if this bit is set, then the sram contents are valid. if this bit is cleared, then the sram contents can be corrupted. vdd 3v typ 12 v 2.6v por trip 3.0v typ lvf trip 2.1v typ reg_dvdd por_trip reset (internal a ctive low reset signal) enable_lvf 20ms typ 08463-018 figure 19. typical power-on cycle
aduc7039 rev. b | page 48 of 92 system clocks the aduc7039 integrates a flexible clocking system that can be clocked from one of two integrated on-chip oscillators: a precision oscillator or a low power oscillator. each of the internal oscillators is divided by four to generate a clock frequency of 32 khz. the pll locks onto a multiple (640) of 32 khz, supplied by either of the internal oscillators, to provide a stable 20.48 mhz clock for the system. by default, the pll is driven by the low power oscillator. the core operates at a fixed frequency of 10.24 mhz, by default. the adc is driven by the output of the pll, divided to give an adc clock source of 512 khz. in low power mode, the adc clock source is switched from the standard 512 khz to the low power 128 khz oscillator. note that the low power oscillator drives both the watchdog and core wake-up timers through a divide-by-four circuit. a detailed block diagram of the aduc7039 clocking system is shown in figure 20 . the two integrated oscillators can be calibrated as described in the oscillators calibration section. 128khz div 4 precision oscillator low power oscillator 128khz div 4 pllcon pll flash controller 32khz 32khz pll output 20.48mhz pll lock 1 8 adcmde clock divider core clock 1 2 mcu adc clock adc timer0 core clock high accuracy calibration counter precision oscillator timer2 watchdog low power oscillator timer1 wake-up low power oscillator core clock spi core clock pll output low power calibration counter low power oscillator lin interface low power oscillator core clock 08463-019 figure 20. aduc7039 system clock generation
aduc7039 rev. b | page 49 of 92 the operating mode and clocking mode are controlled using two mmrs, pllcon and powcon, and the status of the pll, pll lock and pll interrupt, is indicated by pllsta. it is recommended that before powering down the aduc7039, switch the clock source for the pll to the low power oscillator to reduce wake-up time. the low power oscillator is always active. when the aduc7039 wakes up from power-down, the mcu core begins executing code as soon as the pll begins oscillat- ing. this occurs before the pll has locked to a frequency of 20.48 mhz. to ensure the flash/ee memory controller is execut- ing with a valid clock, the controller is driven with a pll output divide-by-eight clock source while the pll is locking. when the pll locks, the pll output is switched from the pll output divide-by-eight to the locked pll output. if user code requires an accurate pll output, user code must poll the lock bit (pllsta[1]) after wake-up before resuming normal code execution. the pll is locked within 2 ms after waking up. pllcon is a protected mmr with two 32-bit keys: pllkey0 (prewrite key) and pllkey1 (postwrite key). pllkey0 = 0x000000aa pllkey1 = 0x00000055 powcon is a protected mmr with two 32-bit keys: powkey0 (prewrite key) and powkey1 (postwrite key). powkey0 = 0x00000001 powkey1 = 0x000000f4 an example of writing to both mmrs is as follows: for programming the powcon mmr: ; void powerdown (void) powerdown proc ldr r2, = 0x98765432 ; load random number for multiplication ldr r3, = 0x12345678 ldr r0, = 0xffff0400 ;base address movs r1,#0x1 ;powkey0 = 1 str r1,[r0,#4] ;set powkey0 movs r1,#0x01 ;set powcon value to recommended value of 0x01 to ensure a 10 mhz core clock str r1,[r0,#8] movs r1,#0xf4 str r1,[r0,#0xc] ;set powkey1 umlal r1,r3,r2,r0 ;longest possible assembly multiplication instruction bx lr ;flush arm7 pipeline endp for programming the pllcon mmr: pllkey0 = 0xaa //pllcon key pllcon = 0x1 //switch to precision oscillator. pllkey1 = 0x55 //pllcon key ia1*ia2 //pseudocode-dummy cycle to pr event flash/ee access during clock change
aduc7039 rev. b | page 50 of 92 pllsta register name: pllsta address: 0xffff0400 default value: 0xxx access: read only function: this 8-bit register allows user code to monitor the lock state of the pll. table 37. pllsta mmr bit designations bit description 7 to 2 reserved. 1 pll lock status bit, read only. this bit is set automatically when th e pll is locked and outputting 20.48 mhz. this bit is cleared automatically when the pll is not locked and outputting an f core divide-by-8 clock source. 0 pll interrupt. set this bit if the pll lock status bit signal goes low. this bit is cleared by user code when writing 1 to this bit. pllcon prewrite key pllkey0 name: pllkey0 address: 0xffff0410 access: write only key: 0x000000aa function: pllcon is a keyed register that requires a 32-bit key value to be written before and after pllcon. pllkey0 is the prewrite key. pllcon postwrite key pllkey1 name: pllkey1 address: 0xffff0418 access: write only key: 0x00000055 function: pllcon is a keyed register that requires a 32-bit key value to be written before and after pllcon. pllkey1 is the postwrite key. pllcon register name: pllcon address: 0xffff0414 default value: 0x00 access: read/write function: this 8-bit register allows user code to dynamically select the pll source clock from two different oscillator source s.
aduc7039 rev. b | page 51 of 92 table 38. pllcon mmr bit designations bit description 7 to 1 reserved. these bits should be written as 0 by user code. 0 pll clock source. 1 0 = lower power oscillator. 1 = precision oscillator. 1 if the user code switches mcu clock sources, a dummy mcu cycle should be included after the clock switch is written to pllcon. powcon prewrite key powkey0 name powkey0 address 0xffff00 access write only key 0x00000001 function powcon is a keyed register that requires a 2-bit key value to be written before and after powcon powkey0 is the prewrite key powcon postwrite key powkey1 name powkey1 address 0xffff00c access write only key 0x000000f function powcon is a keyed register that requires a 2-bit key value to be written before and after powcon powkey1 is the postwrite key powcon register name powcon address 0xffff00 default value 0x07 access read/write function this 12-bit register allows user code to dynamically enter various low power modes
aduc7039 rev. b | page 52 of 92 table 39. powcon mmr bit designations bit description 11 to 9 reserved. these bits should be written as 0. 8 precision oscillator enable. this bit is set by the user to enable the precision oscillator. this bit is cleared by the user to power down the precision oscillator. 7 to 6 reserved. these bits should be written as 0. 5 pll power-down. timer peripherals power down if driven from the pll output clock. timers dr iven from an active clock source remain active. this bit is set by default, and se t by hardware on a wake-up event. this bit is cleared to 0 to power down the pll. the pll should not be powered down if either the core or peripherals are enabled: bit 3, bit 4, and bit 5 must be cleared simultaneously. 4 peripherals power-down. the peripherals that are powered down by this bit are as follows: sram, flash/ee memory and gpio interfaces, and spi port. this bit is set by default, and/or by hardware, on a wake-up event. wake-up timer (timer2) can still be active if driven from low power oscillator even if this bit is set. this bit is cleared to power down the peripherals. the periph erals cannot be powered down if the core is enabled: bit 3 and bit 4 must be cleared simultaneously. lin can still respond to wake-up events even if this bit is cleared. 3 core power-down. if user code powers down the mcu, include a dummy mcu cycle after the power-down command is written to powcon. this bit is set by default, and se t by hardware on a wake-up event. this bit is cleared to power down the arm core. 2 to 0 core clock divider (cd) bits. 000 = 20.48 mhz, 48.83 ns. 001 = 10.24 mhz, 97.66 ns (this is the default setting at power-up). 010 = 5.12 mhz, 195.31 ns. 011 = 2.56 mhz, 390.63 ns. 100 = 1.28 mhz, 781.25 ns. 101 = 640 khz, 1.56 s. 110 = 320 khz, 3.125 s. 111 = 160 khz, 6.25 s.
aduc7039 rev. b | page 53 of 92 oscillators calibration the aduc7039 features two oscillators and two calibration schemes: ? t he low power oscillator can be calibrated from the precision oscillator or from the lin communication. the trim value can also be modified by user code. ? t he precision oscillator can be calibrated from the lin communication. the trim value can also be modified by user code. each oscillator has dedicated calibration mmrs: ? l ocusr0 is the low power oscillator user trim register. it is a 8-bit wide register. increasing the value in locusr0 decreases the frequency of the low power oscillator; decreasing the value increases the frequency. based on a nominal frequency of 128 khz, the typical trim range is between 103 khz to 156 khz. this mmr can be written directly by user code or changed automatically by the hardware relative to the lin baud rate. ? l ocusr1 is the precision oscillator user trim register. this is a 10-bit wide mmr. increasing the value in locusr1 decreases the frequency of the precision oscillator; decreasing the value increases the frequency. based on a nominal frequency of 128 khz, the typical trim range is between 94 khz to 178 khz. this mmr can be written directly by user code, or changed automatically by the hardware relative to the lin baud rate. ? l ocval0 is an 8-bit, read-only mmr and displays the current trim value of the low power oscillator. ? l ocval1 is a 10-bit, read-only mmr and displays the current trim value of the precision oscillator. note that 11 bits can be read from this register but only 10 are used for calibration. initial low power os cillator calibration after reset, the low power oscillator is running at a frequency of 128 khz with a maximum error of ?10% to +3% from the center frequency of 128 khz. an end-of-line calibration at the customer production line must be run within a given temperature range of 25c 5c to center the low power oscillator on the precision oscillator. once calibrated, the low power oscillator stays within 3% of the center frequency. this initial calibration only needs to be run once, at end-of-line. further calibration can be performed in user code to compen- sate for temperature drift of the low power oscillator. low power oscillator ca libration sequence the low power 128 khz oscillator can be calibrated using the precision 128 khz oscillator. two dedicated calibration counters are used to implement this feature. one counter, 9-bits wide, is clocked by the precision oscillator. the second counter, 10-bits wide, is clocked by the low power oscillator. the clock calibration mode is configured and controlled by the following mmrs: ? o scconcontrol bits for calibration. ? oscstacalibration status register. ? oscval09-bit counter, counter 0. ? oscval110-bit counter, counter 1. an example calibration routine is shown in figure 21 . user code configures and enables the calibration sequence using osccon. when the precision oscillator calibration counter, oscval0, reaches 0x1ff, both counters are disabled. user code then reads back the value of the low power oscillator calibration counter. there are three possible scenarios: ? oscval0 = oscval1. no further action is required. ? oscval0 > oscval1. the low power oscillator is running slow. locusr0 must be decreased. ? oscval0 < oscval1. the low power oscillator is running fast. locusr0 must be increased. when the locusr0 has been changed, the routine should be run again and the new frequency checked. note that the locusr0 mmr is key protected. the value 0x1324 must be written in lockey prior to writing locusr0. using the internal, precision oscillator, it takes approximately 4 ms to execute the calibration routine. wait for interrupt osc0val0 < osc0val1 osc0val0 > osc0val1 end calibration routine is error within desired level? osc0val0 = osc0val1 no yes begin calibration routine decrease locusr0 increase locusr0 08463-020 figure 21. osctrm calibration routine prior to the clock calibration routine being started, it is required that the user switch to the precision oscillator to serve as the pll clock source, otherwise, the pll can lose lock each time locusr0 is modified. this increases the length of time it takes to calibrate the low power oscillator.
aduc7039 rev. b | page 54 of 92 osccon register name: osccon address: 0xffff0440 default value: 0x00 access: read/write function: this 8-bit register controls the low power oscillator calibration routine. table 40. osccon mmr bit designations bit description 7 to 4 reserved. should be written as 0. 3 calibration reset. this bit is set by user code to reset the cali bration counters and disable the calibration logic. this bit is cleared by user code after a calibration reset. 2 oscval1 reset. this bit is set by user code to clear oscval1. this bit is cleared by user code after clearing oscval1. 1 oscval0 reset. this bit is set by user code to clear oscval0. this bit is cleared by user code after clearing oscval0. 0 calibration enable. this bit is set by user code to begin calibration. this bit is cleared by user code to abort calibration. oscsta register name: oscsta address: 0xffff0444 default value: 0x00 access: read only function: this 8-bit register gives the status of the low power oscillator calibration routine. table 41. oscsta mmr bit designations bit description 7 to 3 reserved. 2 oscillator calibration complete. this bit is set by hardware on full completion of a calibration cycle. this bit is cleared by a read of oscval1. 1 busy bit. this bit is set by hardware if calibration is in progress. this bit is cleared by hardware if calibration is completed. 0 calibration finished interrupt. this bit is set by hardware on deassertion of bit 1. this bit is cleared by read of oscsta mmr.
aduc7039 rev. b | page 55 of 92 oscval0 register name: oscval0 address: 0xffff0448 default value: 0x00 access: read only function: this 9-bit counter is clocked from the 128 khz precision oscillator. oscval1 register name: oscval1 address: 0xffff044c default value: 0x0000 access: read only function: this 10-bit counter is clocked from the low power, 128 khz oscillator. note that 11 bits can be read, but only 10 bi ts are used. lin oscillator calibration a second calibration mechanism is provided on the aduc7039 to calibrate the oscillators. this new feature allows for the cali- bration of the clocks relative to a synchronization element of a lin packet. it is based on a fixed and predefined lin baud rate. the new trim value is derived from a lin communication. this method requires sufficient lin transactions, approximately 1 for every 10 degrees change in temperature. if the baud rate measured by the lin peripheral in the linbr mmr is outside the limits defined by user code in locmin and locmax mmr, the selected oscillator trim bit is modified accordingly to the options selected in the lin oscillator calibration control register, that is, by the number of steps defined in loccon. two read-only trim registers indicate the trim currently used for each of the oscillators. the lin oscillator calibration block modifies these two read-only registers and does not modify the user registers locusrx. when a calibration is complete the lin oscillator calibration can be disabled, but before being disabled, the value of the locvalx must be copied into the corresponding locusrx register. an example is given in the next section. the status register indicates if the trim register of the selected oscillator has been altered. there are 9 mmrs available: loccon register name: loccon address: 0xffff0480 default value: 0x00 access: read/write (key protected) function: oscillator calibration via lin control register. locusr0 register name: locusr0 address: 0xffff0484 default value: updated by kernel access: read/write (key protected) function: user trim register for the low power oscillator. locusr1 register name: locusr1 address: 0xffff0488 default value: updated by kernel access: read/write (key protected) function: user trim register for the precision oscillator.
aduc7039 rev. b | page 56 of 92 locmax register name: locmax address: 0xffff048c default value: 0x00000 access: read/write function: maximum limit expectable in the linbr for a predefined baud rate. locmin register name: locmin address: 0xffff0490 default value: 0x00000 access: read/write function: minimum limit expectable in the linbr for a predefined baud rate. locsta register name: locsta address: 0xffff0494 default value: 0x01 access: read only function: calibration status register. locval0 register name: locval0 address: 0xffff0498 default value: updated by kernel access: read only function: current low power oscillator trim value, read-only. locval1 register name: locval1 address: 0xffff049c default value: updated by kernel access: read only function: current precision oscillator trim value, read-only. lockey register name: lockey address: 0xffff04a0 access: write only function: must be written to unlock any of the writable calibration register. the value to write to this mmr is 0x1324. table 42. loccon mmr bit designations bit description 7 to 3 reserved. read 0. 2 to 1 oscillator calibration step size. 0x00 = default value, step of 1. 0x01 = step of 2. 0x10 = step of 3. 0x11 = step of 4. 0 oscillator calibration via lin enabled. this bit is set by the user to enable automatic calibrat ion of the selected oscillator, based on the lin baud rate. this bit is cleared by the user to disable this automatic calibration.
aduc7039 rev. b | page 57 of 92 table 43. locsta mmr bit designations bit description 7 to 3 reserved. read 0. 2 low power oscillator trim value modified. this bit is set by hardware when the precision oscillator trim value is altered. this bit is cleared by hardware on a read of locsta mmr. 1 precision oscillator trim value modified. this bit is set by hardware when the precision oscillator trim value is altered. this bit is cleared by hardware on a read of locsta mmr. 0 oscillator selected. this bit is set by hardware to indicate that the low power oscillator is selected for calibration. this bit is cleared by hardware to indicate that the precision oscillator is selected for calibration. a typical sequence for starting the lin calibration is as follows. locmin = expected_linbr_value-0x20; //define tolerance locmax = expected_linbr_value+0x20; //define tolerance lockey = 0x1324; //unlock key protection loccon = 0x1; //enable calibration with step size = 1 an example to calibrate the low power oscillator using lin communication: lincon = 0x800; //enable lin expected_baudrate = 0x10ab; //correspond to 19200 bps locmin = expected_linbr_value-0x20; //define tolerance locmax = expected_linbr_value+0x20; //define tolerance lockey = 0x1324; //unlock key protection loccon = 0x1; //enable calibration with step size = 1 while ((locsta & 0x05)!= 0x05){} //wait for the trim value to be modified while ((linbrlocmax)){} //wait for the correct baud rate temp_trim = locval0; //store the trim value given lockey = 0x1324; //unlock key protection locusr0 = temp_trim; //write the trim value into the user mmr lockey = 0x1324; //unlock key protection loccon = 0; //turn off the lin calibration block
aduc7039 rev. b | page 58 of 92 interrupt system there are 10 interrupt sources on the aduc7039 that are con- trolled by the interrupt controller. most interrupts are generated from the on-chip peripherals such as the adc and timers. the arm7tdmi-s cpu core only recognizes interrupts as one of two types: a normal interrupt request (irq) and a fast interrupt request (fiq). all the interrupts can be masked separately. the control and configuration of the interrupt system is managed through nine interrupt-related registers: four dedicated to irq and four dedicated to fiq. an additional mmr is used to select the programmed interrupt source. the bits in each irq and fiq register represent the same interrupt source as described in table 44 . irqsta/fiqsta should be saved immediately upon entering the interrupt service routine (isr) to ensure that all valid interrupt sources are serviced. the interrupt generation to the arm7tdmi-s core is shown in figure 22 . consider the example of timer0, which is configured to generate a timeout every 5 ms. after the first 5 ms timeout, fiqsig/irqsig[2] is set and can only be cleared by writing to t0clri. if timer0 is not enabled in either irqen or fiqen, then fiqsta/irqsta[2] is not set and an interrupt does not occur. however, if timer0 is enabled in either irqen or fiqen, then either fiqsta/irqsta[2] is set or an interrupt (either an fiq or irq) occurs. irqsta fiqsta irqsig fiqsig timer0 timer1 timer2 lin h/w flash/ee pll lock adc spi hv fiqen timer0 timer1 timer2 lin h/w flash/ee pll lock adc spi hv irq fiq 08463-021 figure 22. interrupt structure note that the irq a tions in the cpsr le 44. ir s bit designations nd fiq interrupt bit defini only control interrupt recognition by the arm core, not by the peripherals. for example, if timer2 is configured to generate an irq via irqen, the irq interrupt bit is set (disabled) in the cpsr, and the aduc7039 is powered down. when an interrupt occurs, the peripherals are woken, but the arm core remains powered down. this is equivalent to powcon = 0x71. the arm core can only be powered up by a reset event if this occurs. tab q/fiq mmr bit description comments 0 all in ter rupts ored only available in the fiq mmrs 1 swi not used in irq en/clr and fiqen/clr 2 t imer0 3 timer1 or wake-up timer 4 time r2 or watchdog timer 5 lin 6 f lash/ee interrupt 7 pll lock 8 adc 9 spi 10 high voltage 11 low powe r oscillator calibration complete 1 2 to 31 reserved
aduc7039 rev. b | page 59 of 92 irq the irq is the exception signal to enter the irq mode of the processor. it is used to service the general-purpose interrupt handling of internal and external events. all 32 bits are logically ored to create a single irq signal to the arm7tdmi-s core. the four 32-bit registers dedicated to irq follow. irqsig irqsig is a read-only register that reflects the status of the different irq sources. if a peripheral generates an irq signal, the corresponding bit in the irqsig is set; otherwise, it is cleared. the irqsig bits are cleared when the interrupt in the particular peripheral is cleared. all irq sources can be masked in the irqen mmr. irqen irqen provides the value of the current enable mask. when a bit is set to 1, the corresponding source request is enabled to create an irq exception. when a bit is set to 0, the corre- sponding source request is disabled or masked which does not create an irq exception. the irqen register cannot be used to disable an interrupt. irqclr irqclr is a write-only register that allows the irqen register to clear to mask an interrupt source. each bit set to 1 clears the corresponding bit in the irqen register without affecting the remaining bits. the pair of registers, irqen and irqclr, allow independent manipulation of the enable mask without requiring an atomic read-modify-write. irqsta irqsta is a read-only register that provides the current enabled irq source status (effectively a logic and of the irqsig and irqen bits). when set to 1, that source generates an active irq request to the arm7tdmi-s core. there is no priority encoder or interrupt vector generation. this function is implemented in software in a common interrupt handler routine. fast interrupt request (fiq) the fast interrupt request (fiq) is the exception signal to enter the fiq mode of the processor. it is provided to service data transfer or communication channel tasks with low latency. the fiq interface is identical to the irq interface and provides the second level interrupt (highest priority). four 32-bit registers are dedicated to fiq: fiqsig, fiqen, fiqclr, and fiqsta. bit 31 to bit 1 of fiqsta are logically ored to create the fiq signal to the core and to bit 0 of both the fiq and irq registers (fiq source). the logic for fiqen and fiqclr does not allow an interrupt source to be enabled in both irq and fiq masks. a bit set to 1 in fiqen clears, as a side effect, the same bit in irqen. likewise, a bit set to 1 in irqen clears, as a side effect, the same bit in fiqen. an interrupt source can be disabled in both irqen and fiqen masks. programmed interrupts because the programmed interrupts are not maskable, they are controlled by another register, swicfg that writes into both irqsta and irqsig registers and/or the fiqsta and fiqsig registers at the same time. the 32-bit register dedicated to software interrupt is swicfg described in table 45 . this mmr allows the control of a pro- grammed source interrupt. table 45. swicfg mmr bit designations bit description 31 to 3 reserved. 2 programmed interrupt fiq. setting/clearing this bit corresponds to setting/clearing bit 1 of fiqsta and fiqsig. 1 programmed interrupt irq. setting/clearing this bit corresponds to setting/clearing bit 1 of irqsta and irqsig. 0 reserved. note that any interrupt signal must be active for at least the minimum interrupt latency time, to be detected by the interrupt controller and to be detected by the user in the irqsta/fiqsta register.
aduc7039 rev. b | page 60 of 92 timers the aduc7039 features three general-purpose timers/counters: ? timer0, or general-purpose timer ? timer1, or wake-up timer ? timer2, or watchdog timer timers are started by writing data to the control register of the corresponding timer (txcon). the counting mode and speed depend on the configuration chosen in txcon. in normal mode, an irq is generated each time the value of the counter reaches 0 when counting down, or each time the counter value reaches full scale when counting up. an irq can be cleared by writing any value to clear the register of that particular timer (txclri). the three timers in their normal mode of operation can be either free-running or periodic. in free-running mode, starting with the value in the txld register, the counter decrements/increments from the maximum/ minimum value until zero/full scale and starts again at the maximum/minimum value. this means that, in free-running mode, txval is not re-loaded when the relevant interrupt bit is set but the count simply rolls over as the counter underflows or overflows. in periodic mode, the counter decrements/increments from the value in the load register (txld mmr) until zero/full scale starts again from this value. this means when the relevant interrupt bit is set, txval is re-loaded with txld and counting starts again from this value. loading the txld register with zero, is not recommended. the value of a counter can be read at any time by accessing its value register (txval). synchronization of timers across asynchronous clock domains figure 23 shows the interface between the users timer mmrs and the core timer blocks. user code can access all timer mmrs directly, including txld, txval, txcon, and txclri. data must then transfer from these mmrs to the core timers (t0, t1, and t2) within the timer subsystem. theses core timers are buffered from the users mmr interface by the synchronization (sync) block. the main purpose of the sync block is to provide a method that ensures data and other required control signals and can cross asynchronous clock domains correctly. an example of asynchronous clock domains is the mcu running on 10 mhz core clock and timer1 running on the low power oscillator of 32 khz. 08463-033 useer mmr inerface t0 reg t1 reg t2 reg arm7tdmi amba core clock low power oscillator t0 sync t1 sync t2 sync t0 t1 t2 0 1 2 t2irq t1irq t0irq w d r st amba figure 23. timer block diagram
aduc7039 rev. b | page 61 of 92 timer 2 low power clock domain synchronized signal unsynchronized signal core clock (fcore) domain synchronizer flip-flops target clock 08463-034 figure 24. synchronizer for signals crossing clock domains as can be seen from figure 23 , the mmr logic and core timer logic reside in separate and asynchronous clock domains. any data coming from the mmr core-clock domain and being passed to the internal timer domain must be synchronized to the internal timer clock domain to ensure it is latched correctly into the core timer clock domain. this is achieved by using two flip-flops as shown in figure 24 to not only synchronize but also to double buffer the data and thereby ensuring data integrity in the timer clock domain. as a result of the synchronization block, while timer control data is latched almost immediately (with the fast, core clock) in the mmr clock domain, this data in turn will not reach the core timer logic for at least two periods of the selected internal timer domain clock. programming the timers understanding the synchronization across timer domains also requires the user code to carefully program the timers when stopping or starting them. the recommended code controls the timer block when stopping and starting the timers and when using different clock domains. this can be in particular very critical if timers are enabled to generate a irq or fiq exception, an example, using timer1 follows. halting timer1 when halting timer1, it is recommended that irqen bit for timer1 be masked (using irqclr). this prevents unwanted irqs from generating an interrupt in the mcu before the t1con control bits have been latched in the timer1 internal logic. irqclr = wakeup_timer_bit; // masking interrupts t1con = 0x00; // halting the timer, starting timer1 when starting timer1, it is recommended to first load timer1 with the required txld value. next, start the timer by setting the t1con bits as required. this enables the timer but only once the t1con bits have been latched internally in the timer1 clock domain. therefore, it is advised that a delay of more than three clock periods (that is, 100 s for a 32 khz timer clock source) is inserted to allow both the t1ld value and the t1con value to be latched through the synchronization logic and reach the timer1 domain. after the delay, it is recom- mended that any (inadvertent) timer1 interrupts are now cleared using t1clri = 0x00. finally, the timer1 system interrupt can be unmasked by setting the appropriate bit in the irqen mmr. an example of this code follows. example code it is assumed timer1 is halted as previously described. t1ld = 0x1; // reload timer t1con = 0x001f; // enable timer, low power oscillator, 32768 prescaler, periodic delay(100us); // include delay to ensure t1con bits take effect t1clri = 0 ; //* clear timer irq irqen = wakeup_timer_bit; // unmask timer1
aduc7039 rev. b | page 62 of 92 timer0general-purpose timer timer0 is a general-purpose 16-b it count-up/count-down timer. timer0 is clocked from the core clock with a prescalar of either 1 or 16,384. this gives a minimum resolution of 1.6 ms with a prescalar of 16,384, and the timer can count for more than 1 minute. timer0 can count up or count down. a 16-bit value can be written to t0ld that is loaded into the counter. the current counter value can be read from t0val. timer0 reloads the value from t0ld either when timer0 overflows. the timer0 interface consists of four mmrs. ? t0ld is a 16-bit register that holds the 16-bit value that is loaded into the counter. ? t0val is a 16-bit register that holds the 16-bit current value of timer0. ? t0clri is an 8-bit register. writing any value to this register clears the timer0 interrupt. ? t0con is a 16-bit configuration register described in table 46 . timer0 load registers name: t0ld address: 0xffff0300 default value: 0x0000 access: read/write function: t0ld is the 16-bit register holding the 16-bit value that is loaded into the counter. timer0 value registers name: t0val address: 0xffff0304 default value: 0x0000 access: read only function: t0val is a 16-bit register that holds the current value of timer0. timer0 control register name: t0con address: 0xffff0308 default value: 0x0000 access: read/write function: this 16-bit mmr configures the mode of operation for timer0. timer0 clear register name: t0clri address: 0xffff030c access: write only function: this 8-bit, write-only mmr is written (with any value) by user code to clear the interrupt.
aduc7039 rev. b | page 63 of 92 timer0 value core clock frequency prescaler 1 or 16,384 timer0 irq 16-bit up/down counter 16-bit load 08463-022 figure 25. timer0 diagram table 46. t0con mmr bit designations bit description 15 to 6 reserved. 5 timer0 mode. this bit is set by user code to operate in periodic mode. this bit is cleared by user code to operate in free running mode (default). 4 count up. this bit is set by user code for timer0 to count up. this bit is cleared by user code for timer0 to count down (default). 3 timer0 enable bit. this bit is set by user code to enable timer0. this bit is cleared by user code to disable timer0 (default). 2 reserved. 1 to 0 prescaler. 00 = source clock/1 (default). 01 = source clock/1 10 = source clock/16,384. 11 = source clock/16,384.
aduc7039 rev. b | page 64 of 92 timer1wake-up timer timer1 is a 32-bit wake-up timer (count-down or count-up) with a programmable prescalar. the selected clock source, core clock, or low power oscillator can be scaled by a factor of 1, 16, 256, or 32,768. the wake-up timer continues to run when the core clock is disabled, if clocked from the low power oscillator. timer1 reloads the value from t1ld when timer1 overflows. the timer1 interface consists of four mmrs. ? t1ld and t1val are 32-bit registers and hold 32-bit unsigned integers. t1val is read-only. ? t1clri is an 8-bit register. writing any value to this register clears the timer1 interrupt. ? t1con is a 16-bit configuration register described in table 47 . timer1 load registers name: t1ld address: 0xffff0320 default value: 0x00000000 access: read/write function: t1ld is a 32-bit register that holds the 32-bit value that is loaded into the counter. timer1 value register name: t1val address: 0xffff0324 default value: 0xffffffff access: read only function: t1val is a 32-bit register that holds the current value of timer1. timer1 clear register name: t1clri address: 0xffff032c access: write only function: t1clri is an 8-bit, write-only mmr is written (with any value) by user code to clear the interrupt. timer1 control register name: t1con address: 0xffff0328 default value: 0x0000 access: read/write function: t1con is a 16-bit mmr that configures the mode of operation of timer1.
aduc7039 rev. b | page 65 of 92 timer1 value low power oscillator core cloc k frequency prescaler 1, 16, 256, or 32,768 timer1 irq 32-bit up/down counter 32-bit load 08463-100 figure 26. timer1 block diagram table 47. t1con mmr bit designations bit description 15 to 6 reserved. these bits should be written as 0. 5 timer1 mode. this bit is set by user code to operate in periodic mode. this bit is cleared by user code to operate in free running mode (default). 4 count up. this bit is set by user code for timer1 to count up. this bit is cleared by user code for timer1 to count down (default). 3 timer1 enable bit. this bit is set by user code to enable timer1. this bit is cleared by user code to disable timer1 (default). 2 clock select. 0 = core clock (default). 1 = low power (32.768 khz) oscillator. 1 to 0 prescaler. 00 = source clock/1 (default). 01 = source clock/16. 10 = source clock/256. 11 = source clock/32,768.
aduc7039 rev. b | page 66 of 92 timer2watchdog timer timer2 has two modes of operation: normal mode and watchdog mode. the watchdog timer is used to recover from an illegal software state. once enabled, it requires periodic servicing to prevent it from forcing a reset of the processor. timer2 reloads the value from t2ld when timer2 overflows in normal mode, or immediately when t2clri is written in watchdog mode. normal mode timer2 in normal mode is identical to timer0 in 16-bit mode of operation, except for the clock source and prescaler. the clock source is the low power oscillator and can be scaled by a factor of 1, 16, or 256. watchdog mode watchdog mode is entered by setting t2con[5]. timer2 decrements from the timeout value present in the t2ld register until 0. the maximum timeout is 524 seconds, using the maximum prescalar of 1/256 and full scale in t2ld. user software should not configure a timeout period of less than 30 ms. this is to avoid any conflict with flash/ee memory page erase cycles, which require 20 ms to complete a single page erase cycle. if t2val reaches 0, a reset or an interrupt occurs, depending on t2con[1]. to avoid a reset or an interrupt event, any value must be written to t2clri before t2val reaches 0. this reloads the counter with t2ld and begins a new timeout period. once watchdog mode is entered, t2ld and t2con are write- protected. these two registers cannot be modified until a power-on reset event resets the watchdog timer. after any other reset event, the watchdog timer continues to count. the watchdog timer should be configured in the initial lines of user code to avoid an infinite loop of watchdog resets. timer2 is automatically halted during the jtag debug access and recommences counting only once jtag has relinquished control of the arm7 core. by default, timer2 continues to count during power-down. this can be disabled by setting t2con[0]. it is recommended that the default value be used, that is, that the watchdog timer continue to count during power-down. the timer2 interface consists of four mmrs. ? t2ld is a 16-bit register that holds the 16-bit value that is loaded into the counter. ? t2val is a 16-bit register that hold the 16-bit current value of timer2. ? t2clri is an 8-bit register. writing any value to this register clears the timer2 interrupt in normal mode or resets a new timeout period in watchdog mode. ? t2con is a 16-bit configuration register described in table 48 . timer2 load registers name: t2ld address: 0xffff0340 default value: 0x0050 access: read/write function: t2ld is a 16-bit register that holds the 16-bit value that is loaded into the counter. timer2 clear register name: t2clri address: 0xffff034c access: write only function: this 8-bit, write-only mmr is written (with any value) by user code to clear the interrupt, if in normal mode or to reset the timeout if in watchdog mode. timer2 value register name: t2val address: 0xffff0344 default value: 0x0050 access: read only function: t2val is a 16-bit register that holds the current value of timer2. timer2 control register name: t2con address: 0xffff0348 default value: 0x0000 access: read/write function: this 16-bit mmr configures the mode of operation of timer2.
aduc7039 rev. b | page 67 of 92 prescaler 1, 16, 256 timer2 irq watchdog reset 16-bit up/down counter low power oscillator 16-bit load timer2 value 0 8463-024 figure 27. timer2 block diagram table 48. t2con mmr bit designations bit description 15 to 9 reserved. these bits are reserved and should be written as 0 by user code. 8 count up/count down enable. this bit is set by user code to configure timer2 to count up. this bit is cleared by user code to configure timer2 to count down. 7 timer2 enable. this bit is set by user code to enable timer2. this bit is cleared by user code to disable timer2. 6 timer2 operating mode. this bit is set by user code to configure timer2 to operate in periodic mode. this bit is cleared by user to configure timer2 to operate in free running mode. 5 watchdog timer mode enable. this bit is set by user code to enable watchdog mode. this bit is cleared by user code to disable watchdog mode. 4 reserved. this bit is reserved and should be written as 0 by user code. 3 to 2 timer2 clock prescaler. 00 = source clock/1 (default). 01 = source clock/16. 10 = source clock/256. 11 = reserved. 1 watchdog timer irq enable. this bit is set by user code to produce an ir q instead of a reset when the watchdog reaches 0. this bit is cleared by user code to disable the irq option. 0 pd_off. this bit is set by the user code to stop timer2 when the peripherals are powered down us ing bit 4 in the powcon mmr. this bit is cleared by the user code to enable timer2 when the peripherals are powered down using bit 4 in the powcon mmr.
aduc7039 rev. b | page 68 of 92 general-purpose input/output the aduc7039 features six general-purpose bidirectional input/output (gpio) pins. in general, the gpio pins have multiple functions that can be configured by user code. by default, the gpio pins are configured in gpio mode. all gpio pins have an internal pull-up resistor, a sink capability of 0.8 ma and a source capability of 0.1 ma. a typical gpio structure is shown figure 28 . table 49. external gpio pin to internal port signal assignments gpio pin port signal functionality (defined by gpcon) gpio_0 p0.0 general-purpose i/o. ss slave select i/o for spi. gpio_1 p0.1 general-purpose i/o. sclk serial clock i/o for spi. gpio_2 p0.2 general-purpose i/o. miso master input, slave output for spi. gpio_3 p0.3 general-purpose i/o. mosi master output, slave input for spi. gpio_4 p0.4 general-purpose i/o. linrx lin input for lin conformance testing. gpio_5 p0.5 general-purpose i/o. lintx lin output for lin conformance testing. gpio reg_dvdd output drive enable gpdat[31:24] output data gpdat[23:16] input data gpdat[7:0] 08463-0 25 figure 28. aduc7039 gpio the six gpios are grouped into one 6-bit wide port. the gpio assignment within this port is detailed in tabl e 49 . during normal operation, user code can control the function and state of the external gpio pins by these general-purpose registers. all gpio pins retain their external level (high or low) during power-down (powcon) mode. port pins are configured and controlled by four mmrs as follows: ? gpcon: control register ? gpdat: configuration and data register ? gpset: data set ? gpclr: data clear
aduc7039 rev. b | page 69 of 92 gpio port control register name: gpcon address: 0xffff0d00 default value: 0x00000000 access: read/write function: the 32-bit mmr selects the pin function for each port pin. table 50. gpcon mmr bit designations bit description 31 to 21 reserved. these bits are reserved and should be written as 0 by user code. 20 gpio_5 function select bit. this bit is cleared by user code to 0 to configur e the gpio_5 pin as a general-purpose i/o (gpio) pin. this bit is set to 1 by user code to configure th e gpio_5 pin as lin output for lin conformance testing. 19 to 17 reserved. these bits are reserved and should be written as 0 by user code. 16 gpio_4 function select bit. this bit is cleared by user code to 0 to configur e the gpio_4 pin as a general-purpose i/o (gpio) pin. this bit is set to 1 by user code to configure th e gpio_4 pin as lin input for lin conformance testing. 15 to 13 reserved. these bits are reserved and should be written as 0 by user code. 12 gpio_3 function select bit. this bit is cleared by user code to 0 to configur e the gpio_3 pin as a general-purpose i/o (gpio) pin. this bit is set to 1 by user code to configure the gpio_3 pin as mosi, master output, and slave input data for the spi port. 11 to 9 reserved. these bits are reserved and should be written as 0 by user code. 8 gpio_2 function select bit. this bit is cleared to 0 by user code to configur e the gpio_2 pin as a general-purpose i/o (gpio) pin. this bit is set to 1 by user code to configure the gpio_2 pin as miso, master input, and slave output data for the spi port. 7 to 5 reserved. these bits are reserved and should be written as 0 by user code. 4 gpio_1 function select bit. this bit is cleared to 0 by user code to configur e the gpio_1 pin as a general-purpose i/o (gpio) pin. this bit is set to 1 by user code to configure the gpio_1 pin as sclk, serial clock i/o for the spi port. 3 to 1 reserved. these bits are reserved and should be written as 0 by user code. 0 gpio_0 function select bit. this bit is cleared to 0 by user code to configur e the gpio_0 pin as a general-purpose i/o (gpio) pin. this bit is set to 1 by user code to configure the gpio_0 pin as ss , slave select input for the spi port.
aduc7039 rev. b | page 70 of 92 gpio port data register name: gpdat address: 0xffff0d10 default value: 0x000000ff access: read/write function: this 32-bit mmr configures the direction of the gpio pins. this register also sets the output value for gpio pins configured as outputs and reads the status of gpio pins configured as inputs. table 51. gpdat mmr bit designations bit description 31 to 30 reserved. these bits are reserved and should be written as 0 by user code. 29 port 0.5 direction select bit. this bit is cleared to 0 by user code to configur e the gpio pin assigned to port 0.5 as an input. this bit is set to 1 by user code to configure the gpio pin assigned to port 0.5 as an output. 28 port 0.4 direction select bit. this bit is cleared to 0 by user code to configur e the gpio pin assigned to port 0.4 as an input. this bit is set to 1 by user code to configure the gpio pin assigned to port 0.4 as an output. 27 port 0.3 direction select bit. this bit is cleared to 0 by user code to configur e the gpio pin assigned to port 0.3 as an input. this bit is set to 1 by user code to configure the gpio pin assigned to port 0.3 as an output. 26 port 0.2 direction select bit. this bit is cleared to 0 by user code to configur e the gpio pin assigned to port 0.2 as an input. this bit is set to 1 by user code to configure the gpio pin assigned to port 0.2 as an output. 25 port 0.1 direction select bit. this bit is cleared to 0 by user code to configur e the gpio pin assigned to port 0.1 as an input. this bit is set to 1 by user code to configure the gpio pin assigned to port 0.1 as an output. 24 port 0.0 direction select bit. this bit is cleared to 0 by user code to configur e the gpio pin assigned to port 0.0 as an input. this bit is set to 1 by user code to configure the gpio pin assigned to port 0.0 as an output. 23 to 22 reserved. these bits are reserved and should be written as 0 by user code. 21 port 0.5 data output. the value written to this bit ap pears directly on the gpio pin assigned to port 0.5. 20 port 0.4 data output. the value written to this bit ap pears directly on the gpio pin assigned to port 0.4. 19 port 0.3 data output. the value written to this bit ap pears directly on the gpio pin assigned to port 0.3. 18 port 0.2 data output. the value written to this bit ap pears directly on the gpio pin assigned to port 0.2. 17 port 0.1 data output. the value written to this bit ap pears directly on the gpio pin assigned to port 0.1. 16 port 0.0 data output. the value written to this bit ap pears directly on the gpio pin assigned to port 0.0. 15 to 6 reserved. these bits are reserved and should be written as 0 by user code. 5 port 0.5 data input. this bit is a read-onl y bit that reflects the current status of th e gpio pin assigned to port 0.5. user co de should write 0 to this bit. 4 port 0.4 data input. this bit is a read-onl y bit that reflects the current status of th e gpio pin assigned to port 0.4. user co de should write 0 to this bit. 3 port 0.3 data input. this bit is a read-onl y bit that reflects the current status of th e gpio pin assigned to port 0.3. user co de should write 0 to this bit. 2 port 0.2 data input. this bit is a read-onl y bit that reflects the current status of th e gpio pin assigned to port 0.2. user co de should write 0 to this bit. 1 port 0.1 data input. this bit is a read-onl y bit that reflects the current status of th e gpio pin assigned to port 0.1. user co de should write 0 to this bit. 0 port 0.0 data input. this bit is a read-onl y bit that reflects the current status of th e gpio pin assigned to port 0.0. user co de should write 0 to this bit.
aduc7039 rev. b | page 71 of 92 gpio port set register name: gpset address: 0xffff0d14 default value: n/a access: write only function: this 32-bit mmr allows user code to individually bit ad dress external gpio pins to set them high only. user code can accomplish this using the gpset mmr without having to modify or maintain the status of any other gpio pins (as user code requires when using gpdat). table 52. gpset mmr bit designations bit description 31 to 22 reserved. these bits are reserved and should be written as 0 by user code. 21 port 0.5 set bit. this bit is set to 1 by user code to set the external gpio_5 pin high. if user software clears this bit to 0, it has no effect on the external gpio_5 pin. 20 port 0.4 set bit. this bit is set to 1 by user code to set the external gpio_4 pin high. if user software clears this bit to 0, it has no effect on the external gpio_4 pin. 19 port 0.3 set bit. this bit is set to 1 by user code to set the external gpio_3 pin high. if user software clears this bit to 0, it has no effect on the external gpio_3 pin. 18 port 0.2 set bit. this bit is set to 1 by user code to set the external gpio_2 pin high. if user software clears this bit to 0, it has no effect on the external gpio_2 pin. 17 port 0.1 set bit. this bit is set to 1 by user code to set the external gpio_1 pin high. if user software clears this bit to 0, it has no effect on the external gpio_1 pin. 16 port 0.0 set bit. this bit is set to 1 by user code to set the external gpio_0 pin high. if user software clears this bit to 0, it has no effect on the external gpio_0 pin. 15 to 0 reserved. these bits are reserved and should be written as 0 by user code.
aduc7039 rev. b | page 72 of 92 gpio port clear register name: gpclr address: 0xffff0d18 default value: n/a access: write only function: this 32-bit mmr allows user code to individually bit address external gpio pins to clear them low only. user code can accomplish this using the gpclr mmr without having to modify or maintain the status of any other gpio pins (as user code requires when using gpdat). table 53. gpclr mmr bit designations bit description 31 to 22 reserved. these bits are reserved and should be written as 0 by user code. 21 port 0.5 clear bit. this bit is set to 1 by user code to clear the external gpio_5 pin low. if user software clears this bit to 0, it has no effect on the external gpio_5 pin. 20 port 0.4 clear bit. this bit is set to 1 by user code to clear the external gpio_4 pin low. if user software clears this bit to 0, it has no effect on the external gpio_4 pin. 19 port 0.3 clear bit. this bit is set to 1 by user code to clear the external gpio_3 pin low. if user software clears this bit to 0, it has no effect on the external gpio_3 pin. 18 port 0.2 clear bit. this bit is set to 1 by user code to clear the external gpio_2 pin low. if user software clears this bit to 0, it has no effect on the external gpio_2 pin. 17 port 0.1 clear bit. this bit is set to 1 by user code to clear the external gpio_1 pin low. if user software clears this bit to 0, it has no effect on the external gpio_1 pin. 16 port 0.0 clear bit. this bit is set to 1 by user code to clear the external gpio_0 pin low. if user software clears this bit to 0, it has no effect on the external gpio_0 pin. 15 to 0 reserved. these bits are reserved and should be written as 0 by user code.
aduc7039 rev. b | page 73 of 92 serial peripheral interface (spi) the aduc7039 integrates a complete hardware serial peri- pheral interface (spi) on-chip. spi is an industry standard, synchronous serial interface that allows eight bits of data to be synchronously transmitted and simultaneously received, that is, full duplex up to a maximum bit rate of 5.12 mb. the spi port can be configured for master or slave operation and typically consists of four pins: miso, mosi, sclk, and ss . master in, slave out (miso) pin the miso pin is configured as an input line in master mode and an output line in slave mode. the miso line on the master (data in) should be connected to the miso line in the slave device (data out). the data is transferred as byte wide (8-bit) serial data, msb first. master out, slave in (mosi) pin the mosi pin is configured as an output line in master mode and an input line in slave mode. the mosi line on the master (data out) should be connected to the mosi line in the slave device (data in). the data is transferred as byte wide (8-bit) serial data, msb first. serial clock i/o (sclk) pin the master serial clock (sclk) synchronizes the data being transmitted and received through the mosi sclk period. therefore, a byte is transmitted/received after eight sclk periods. the sclk pin is configured as an output in master mode and as an input in slave mode. in master mode, polarity and phase of the clock are controlled by the spicon register, and the bit rate is defined in the spidiv register as follows: )1(2 mhz48.20 spidiv f k serialcloc + = the maximum bit rate in master mode is 10.24 mb. in slave mode, the spicon register must be configured with the phase and polarity of the expected input clock. the slave accepts data from an external master up to 5.12 mb. in both master and slave modes, data is transmitted on one edge of the sclk signal and sampled on the other. therefore, it is important that the polarity and phase are configured the same for the master and slave devices. slave select ( ss ) pin in spi slave mode, a transfer is initiated by the assertion of ss , which is an active low input signal. the spi port then transmits and receives 8-bit data until the transfer is concluded by deas- sertion of ss . in slave mode, ss is always an input. in spi master mode, the ss is an active low output signal. it asserts itself automatically at the beginning of a transfer and deasserts itself upon completion. spi mmr interface the following mmr registers control the spi interface: spista, spirx, spitx, spidiv, and spicon. spirx register name: spirx address: 0xffff0a04 default value: 0x00 access: read only function: this 8-bit mmr is the spi receive register. spitx register name: spitx address: 0xffff0a08 default value: n/a access: write only function: this 8-bit mmr is the spi transmit register. spidiv register name: spidiv address: 0xffff0a0c default value: 0x00 access: read/write function: this 6-bit mmr is the spi baud rate selection register.
aduc7039 rev. b | page 74 of 92 spi status register name: spista address: 0xffff0a00 default value: 0x0000 access: read only function: this 16-bit mmr contains the status of the spi interface in both master and slave modes. table 54. spista mmr bit designations bit description 15 to 12 reserved bits. 11 spi rx fifo excess bytes present. this bit is set when there are more bytes in the rx fifo than indicated in the spirxmde bits in spicon. this bit is cleared when the number of bytes in the fifo is equal or less than the number in spirxmde. 10 to 8 spi rx fifo status bits. [000] = rx fifo is empty. [001] = 1 valid byte in the fifo. [010] = 2 valid byte in the fifo. [011] = 3 valid byte in the fifo. [100] = 4 valid byte in the fifo. 7 spi rx fifo overflow status bit. this bit is set when the rx fifo was already full when new data was loaded to the fifo. this bit generates an interrupt except when spicon[12] is set. this bit is cleared when the spista register is read. 6 spi rx irq status bit. this bit is set when a receive interrupt occurs. this bit is set when spicon[6] is cleared and the required number of bytes hav e been received. this bit is cleared when the spista register is read. 5 spi tx irq status bit. this bit is set when a transmit interrupt oc curs. this bit is set when spicon[6] is se t and the required number of bytes have b een transmitted. this bit is cleared when the spista register is read. 4 spi tx fifo underflow. this bit is set when a transmit is initia ted without any valid data in the tx fifo. this bit generates an interrupt except when spicon[13] is set. this bit is cleared when the spista register is read. 3 to 1 spi tx fifo status bits. 000 = tx fifo is empty. 001 = 1 valid byte in the fifo. 010 = 2 valid byte in the fifo. 011 = 3 valid byte in the fifo. 100 = 4 valid byte in the fifo. 0 spi interrupt status bit. this bit is set to 1 when an spi-based interrupt occurs. this bit is cleared after reading spista.
aduc7039 rev. b | page 75 of 92 spi control register name: spicon address: 0xffff0a10 default value: 0x0000 access: read/write function: this 16-bit mmr configures the spi peripheral in both master and slave modes. table 55. spicon mmr bit designations bit description 15 to 14 spi irq mode bits. these bits configure when the tx/rx interrupts occur in a transfer. 00 = tx interrupt occurs when 1 byte has been transferred. rx in terrupt occurs when 1 or more b ytes have been received into th e fifo. 01 = tx interrupt occurs when 2 bytes have been transferred. rx interrupt occurs when 1 or more bytes have been received into the fifo. 10 = tx interrupt occurs when 3 bytes have been transferred. rx interrupt occurs when 3 or more bytes have been received into the fifo. 11 = tx interrupt occurs when 4 bytes have been transferred. rx interrupt occurs when the rx fi fo is full, or 4 bytes are pres ent. 13 spi tx fifo flush enable bit. set this bit to flush the tx fifo. this bit does not clear itself and should be toggled if a single flush is required. if this bit is left high, then either the last transmitted value or 0x00 is transmitted depending on spicon[7]. any writes to the tx fifo are ignored while th is bit is set. clear this bit to disable tx fifo flushing. 12 spi rx fifo flush enable bit. set this bit to flush the rx fifo. this bit does not clear itself and should be toggled if a single flush is required. if this bit is set, all incoming data is ignored and no interrupts are generated. if set and spicon[6] = 0, a read of the rx fifo initiates a trans fer. clear this bit to disable rx fifo flushing. 11 continuous transfer enable. this bit is set by the user to enable cont inuous transfer. in master mode, the transf er continues until no valid data is availa ble in the spitx register. ss is asserted and remains asserted for the duration of each 8-bit serial transfer until tx is empty. this bit is cleared by the user to disable continuous transfer. each transfer consists of a single 8-bit serial transfer. if va lid data exists in the spitx register, then a new transfer is in itiated after a stall period of 1 serial clock cycle. 10 loop back enable bit. this bit is set by the user to conn ect miso to mosi and test software. this bit is cleared by the user to be in normal mode. 9 slave miso output enable bit. set this bit to disable the output driv er on the miso pin. the miso pin becomes open drain when this bit is set. clear this bit for miso to operate as normal. 8 spirx overflow overwrite enable. this bit is set by the user; the vali d data in the spirx register is overwritten by the new serial byte received. this bit is cleared by the user; the new serial byte received is discarded. 7 spi transmit zeros when tx fifo enable bit. set this bit to transmit 0x00 when th ere is no valid data in the tx fifo. clear this bit to transmit the last transmitted va lue when there is no valid data in the tx fifo. 6 spi transfer and interrupt mode. this bit is set by the user to initiate a transfer with a writ e to the spitx register. interrupt only occurs when spitx is emp ty. this bit is cleared by the user to initiate a transfer with a read of the spirx register. interrupt only occurs when spirx is full. 5 lsb first transfer enable bit. this bit is set by the user; the lsb is transmitted first. this bit is cleared by the user ; the msb is transmitted first.
aduc7039 rev. b | page 76 of 92 bit description 4 spi wired or mode enable bit. this bit is set to 1 to enable open-drain data output enable. external pu ll-ups are required on data out pins. clear this bit for normal output levels. 3 serial clock polarity mode bit. this bit is set by the user; the serial clock idles high. this bit is cleared by the user ; the serial clock idles low. 2 serial clock phase mode bit. this bit is set by the user; the serial clock puls es at the beginning of each serial bit transfer. this bit is cleared by the user; the serial cloc k pulses at the end of each serial bit transfer. 1 master mode enable bit. this bit is set by the us er to enable master mode. this bit is cleared by the user to enable slave mode. 0 spi enable bit. this bit is set by the user to enable the spi. this bit is cleared by the user to disable the spi.
aduc7039 rev. b | page 77 of 92 high voltage peripheral control interface the aduc7039 integrates a number of high voltage circuit functions that are controlled and monitored through a regis- tered interface consisting of two mmrs, namely, hvcon and hvdat. the hvcon register acts as a command byte interpreter allowing the microcontroller to indirectly read or write 8-bit data (the value in hvdat) from or to one of two high voltage status/configuration registers. these high voltage registers are not mmrs but registers commonly referred to as indirect registers; that is, they can only be accessed indirectly via the hvcon and hvdat mmrs. the physical interface between the hvcon register and the indirect high voltage registers is a 2-wire (data and clock) serial interface based on a 2.56 mhz serial clock. therefore, there is a finite, 10 s (maximum) latency between the mcu core writing a command into hvcon and that command or data reaching the indirect high voltage registers. there is also a finite 10 s latency between the mcu core writing a command into hvcon and indirect register data being read back into the hvdat register. a busy bit (bit 0 of the hvcon when read by mcu) can be polled by the mcu to confirm when a read/write command is complete. figure 29 describes the top-level architecture of the high voltage interface and related circuits. the lin physical interface is controlled and monitored via this interface. the high voltage interface consists of two mmrs and two indirect registers: ? hvcon is an 8-bit register acting as a command byte interpreter for the high voltage control interface. bytes written to this register are interpreted as read or write commands to a set of two indirect registers related to the high voltage circuits. these commands are described in table 56 . the success of that operation can be monitored by reading back the hvcon mmr. ? hvdat is a 12-bit register that is used to hold data to be written indirectly to and read indirectly from the high voltage interface registers. ? hvcfg is an 8-bit register controlling the function of high voltage circuits, accessed using hvcon and hvdat. ? hvsta is an 8-bit read-only register reflecting the state of the high voltage circuits. this register is not an mmr and does not appear in the mmr memory map. it is accessed through the hvcon registered interface, and data is read back from this register via hvdat. in response to a high voltage interrupt event, the high voltage interrupt control- ler simultaneously and automatically loads the current value of the high voltage status register (hvsta) into the hvdat register. arm7 mcu and peripherals high voltage interface mmrs hvcon hvdat lin hvcfg[2:0] lvf hvcfg[4] hvcfg (indirect) high voltage registers hvsta serial interface controller serial data serial clock high voltage interrupt controller lin s/c?hvsta[0] irq 0 8463-026 figure 29. high voltage interface, top-level block diagram
aduc7039 rev. b | page 78 of 92 high voltage interface control register name: hvcon address: 0xffff0804 default value: updated by kernel access: read/write function: this 8-bit register acts as a command byte interpreter for the high voltage control interface. bytes written to this register are interpreted as read or write commands to a set of two indirect registers related to the high voltage circuits. the hvdat register is used to store data to be written to, or read back from, the indirect registers. table 56. hvcon mmr write bit designations bit description 7 to 0 command byte. interpreted as 0x00 = read back high voltage register, hvcfg, into hvdat. 0x02 = read back high voltage status register, hvsta, into hvdat. 0x08 = write the value in hvdat to the high voltage register, hvcfg. other = reserved. table 57. hvcon mmr read bit designations bit description 7 to 3 reserved. 2 transmit command to high voltage die status. 1 = command completed successfully. 0 = command failed. 1 read command from high voltage die status. 1 = command completed successfully. 0 = command failed. 0 bit 0 (read-only) busy bit. when user code reads this register, bit 0 should be interpreted as the busy signal for the high voltage interface. this bit can be used to determine if a read request has completed. high voltage (read/write) com- mands as described in this table should not be written to hvcon unless busy = 0. busy = 1, high voltage interface is busy and has not comp leted the previous command written to hvcon. bit 1 and bit 2 are not valid. busy = 0, high voltage interface is not busy and has comple ted the command written to hvcon. bit 1 and bit 2 are valid. high voltage data register name: hvdat address: 0xffff080c default value: updated by kernel access: read/write function: hvdat is a 12-bit register that is used to hold data to be written indirectly to, and read indirectly from, the hvda t, hvsta, hvcfg high voltage interface registers. table 58. hvdat mmr bit designations bit description 11 to 8 command with which the high voltage data, hvdat[7:0], is associated. these bits are read-only and should be written as 0s. 0x00 = read back the high voltage register, hvcfg, into hvdat. 0x02 = read back the high voltage status register, hvsta, into hvdat. 0x08 = write the value in hvdat to the high voltage register, hvcfg. 7 to 0 high voltage data to read/write.
aduc7039 rev. b | page 79 of 92 high voltage configuration register name: hvcfg address: indirectly addressed via the hvcon high voltage interface default value: 0x00 access: read/write function: this 8-bit register controls the function of high vo ltage circuits on the aduc7039. this register is not an mmr and does not appear in the mmr memory map. it is accessed via the hvcon registered interface. data to be written to this register is loaded via the hvdat mmr, and data is read back from this register via the hvdat mmr. table 59. hvcfg bit designations bit description 7 to 5 reserved. 4 low voltage flag (lvf) enable bit. this bit is cleared to 0 to disable the lvf function. this bit is set to 1 to enable the lvf function. the low volt age flag can be interrogated via hvmon[3] after power-up to determine if the reg_dvdd voltage previously dropped below 2.1 v. 3 voltage attenuator diagnostic enable bit. this bit is set to 1 to turn on a current source, which a dds a differential voltage to the voltage channel measurement. this bit is cleared to 0 to disable the voltage attenuator diagnostic. 2 lin driver re-enable bit. this bit is set to 1 to re-enable the lin driver that would have been disabled as a result of a short-circuit current event. this bit is cleared to 0 automatically. 1 enable/disable lin short-circuit protection. this bit is set to 1 to enable passive short-circuit protection on the lin pin. in this mode, a short-circuit event on the lin pin generates a high voltage interrupt (if enabled in irqen[10]) and asserts the appropriate status bit in hvsta but does not disable the short-circuiting pin. this bit is cleared to 0 to enable active short-circuit prot ection on the lin pin. in this mode, during a short-circuit event, the lin pin generates a high voltage interrupt (irq sta[10]), asserts hvsta[0], and automatically disables the short-circuiting pin. when disabled, the i/o pin can only be re-enabled by writing to hvcfg[2]. a lin short circuit event must last longer than 20 s to be detected. 0 lin operating mode. 0 = lin disabled. 1 = lin enabled.
aduc7039 rev. b | page 80 of 92 high voltage status register name: hvsta address: indirectly addressed via the hvcon high voltage interface default value: 0x00 access: read only, this register should only be read on a high voltage interrupt function: this 8-bit, read-only register reflects a change of state for all the corresponding bits in the hvmon register. this register is not an mmr and does not appear in the mmr me mory map. it is accessed through the hvcon registered interface and data is read back from this register via hvda t. in response to a high voltage interrupt event, the high voltage interrupt controller simultaneously and automatically loads the current value of the high voltage status register (hvsta) into the hvdat register. table 60. hvsta bit designations bit description 7 to 3 reserved. these bits should not be used and are reserved for future use. 2 low voltage flag status bit. valid only if enabled via hvcfg[4]. this bit is 0 on power-on if reg_dvdd has dropped below 2. 1 v. in this state, ram contents can be deemed corrupt. this bit is 1 on power-on if reg_dvdd has not dropped below 2. 1 v. in this state, ram contents can be deemed valid. it is only cleared by re-enabling th e low voltage flag in hvcfg[4]. 1 reserved. this bit should not be used and is reserved for future use. 0 lin short-circuit status interrupt. this bit is 0 during normal lin operation and is cleared automatically by reading the hvsta register. this bit is 1 if a lin short circuit is detected. in th is condition, the lin driver is automatically disabled. low voltage flag (lvf) the aduc7039 features a low voltage flag (lvf) that, when enabled, allows the user to monitor reg_dvdd (see the low voltage flag (lvf) section). when enabled via hvcfg[4], the lvf can be monitored through hvsta[2]. if reg_dvdd drops below 2.1 v, then hvsta[2] is cleared and the ram contents are corrupted. after the lvf is enabled, it is only reset by reg_dvdd dropping below 2.1 v or by disabling the lvf functionality using hvcfg[4]. handling hv interface interrupt and hv communication hv interrupt an interrupt controller is also integrated with the high voltage circuits. if enabled through irqen[10], a lin short circuit event can assert the high voltage interrupt signal and interrupt the mcu core. although the normal mcu response to this interrupt event is to vector to the irq or fiq interrupt vector address, the high voltage interrupt controller simultaneously and automatically loads the current value of the high voltage status register (hvsta) into the hvdat register. during this time, the busy bit in hvcon[0] is set to indicate the transfer is in progress and clears after 10 s to indicate the hvsta contents are available in hvdat. the interface should be interrupt driven. the interrupt handler can, therefore, poll the busy bit in hvcon until it deasserts. once the busy bit is cleared, hvcon[1] must be checked to ensure the data was read correctly. then the hvdat register can be read. at this time, hvdat holds the value of the hvsta register. reading the hvsta register clears the interrupt; therefore, it is not recommended to read hvsta at any time.
aduc7039 rev. b | page 81 of 92 isr hvdat[7:0] = hvsta irq/fiqsta = hv irq hvcon[0] = 0 hvcon[1] = 1 hvdat[11:8] = 0x1 no no no no yes yes yes yes other interrupt hvcon = 0x1 (manual read) read hvdat 0 8463-027 figure 30. high voltage interface interrupt flow chart hv configuration following is a code example to enable lin. char hvstatus; do // enable lin hvdat = 0x01; // enable lin physical layer mode hvcon = 0x08; // write to hvcfg do hvstatus = hvcon; while(hvstatus 0x1); // wait until command is finished while ((hvstatus 0x4)); // transmit command is correct it is best practice to implement the high voltage communication routine in a function and call this function throughout the cod e.
aduc7039 rev. b | page 82 of 92 lin (local interconnect network) interface the lin protocol is emulated using an irq/fiq, dedicated lin timers, and the high voltage transceiver also incorporated on chip as shown in figure 31 . the lin is clocked from the low power oscillator when the device is in sleep mode, and from the 10 mhz core clock in normal mode. lin physical interface the aduc7039 features a high voltage physical interface between the arm7 mcu core and an external lin bus. the lin interface operates as a slave only interface, operating from 1 kb to 20 kb and is compatible with the lin 2.1 standard. frequencies below 1 kb are interpreted as 1 kb. the pull-up resistor required for a slave node is on-chip, reducing the need for external circuitry. some external components are recommended, on the lin pin, for best performance for emc and fault protection (see figure 33 ). the lin transceiver is enabled via the 2-wire interface, hvcfg[0]. the lin protocol is controlled by 8 mmrs described in the lin mmrs section. bpf internal short-circuit trip reference internal short-circuit sense resistor output disable hv irq irqen[10] lin mode hvcfg[0] lin interrupt irqen[5] lin interrupt logic input voltage threshold reference vdd external lin pin vdd master ecu protection diode master ecu pull-up c load mask lincs linbk linbr low power o scillator lindat 10mhz rxd txd short-circuit control hvcfg[1] scr over voltage protection io_vss 08463-028 figure 31. lin physical interface 13t bit 2t bit 2t bit 2t bit 2t bit >1t bit > = 14t bit 8t bit break sync sta s0 s1 s2 s3 s4 s5 s6 s7 sto protected id 08463-029 figure 32. lin frame
aduc7039 rev. b | page 83 of 92 lin diagnostic the aduc7039 features a short-circuit protection on the lin pin. if a short-circuit condition is detected on the lin pin, hvsta[0] is set. this generates a high voltage interrupt if enabled in irqen[10]. this bit is cleared by re-enabling the lin driver using hvcfg[2]. it is possible to disable this feature through hvcfg[1]. lin communication lin uses frames for data communication. a frame consists of a header, break, synch, pid issued by the master, and data bytes, plus checksum generated by a slave as shown in figure 32 . in a lin communication, the pid dictates the behavior of the slave: receive, transmit, or ignore. break the lin interface of the aduc7039 automatically detects the break and sets a flag in the linsta register after receiving a valid break. the minimum length of the break symbol is 11 nominal slave clocks (at 20 kb). the maximum length of a valid break symbol is programmable and can be configured in the linbk mmr. the lin interface recognizes a valid break at any time during a lin communication and flags a collision (bit 4 of linsta) if the break occurred during an existing communication. synch the lin interface automatically detects the synch byte and sets the baud rate for the subsequent data of the current lin frame. this operation is transparent to the user. pid the lin peripheral sees the pid as a data byte. it is available in the lindat mmr. the software must decode the pid. after reception of the pid stop bit, an interrupt is generated to read the contents of the lindat register before the contents are overwritten by the next data byte. data bytes subsequent data bytes similarly set the interrupt bit to indicate that a data byte has been received. in transmit mode, up to 8 data bytes can be transmitted at a time followed by a checksum. checksum checksums are automatically calculated as each byte is received or transmitted with the inverted value being stored in the lincs mmr. by default, checksum calculation are per lin 2.1 specifications, that is, with enhanced checksum calculations for all frames except the diagnostic frames and reserved frames where the classic checksum calculation is used. the hardware automatically recognizes the pid and calculates the checksum accordingly. there is no requirement for user code to write to the lincon register to change the checksum calculation. to operate in lin 1.3 mode, user code lin initialization routine must set lincon[7] to 1, to force the hardware in classic checksum calculation. this register should not be modified during lin communication in receive mode. lin mmrs the interface to the lin block consists of 8 mmrs: ? lincon is a 16-bit control register. this mmr is described in table 61 . this register should not be accessed during data reception. ? lindat is an 8-bit user accessible data register. this mmr is double-buffered: a shadow register is used to receive and transmit while user code reads and writes from/to lindat. the linsta mmr indicates the status of the data. ? linsta is a 16-bit status register. this mmr is described in table 62 . ? linbr is a 19-bit baud rate register. the baud rate is automatically set by the lin peripheral and this register should not be altered by user code. it indicates the number of core clock ticks during an 8-bit transmission. ? linbk is a 19-bit break timer register controlling the maximum length of a break symbol to be detected by the lin slave interface as valid. the default count is 5500 core clock ticks. this represents the time taken for 11 bits to be transmitted at 20 khz. ? lincs is an 8-bit checksum register. it contains the inverted result of the current checksum calculation. the checksum calculation is performed on every byte that is received or transmitted according to the setting of bit 4 in lincon mmr. in transmit mode, the user sets the bit after the last data to transmit has been written in the peripheral. the checksum is sent automatically. in receive mode, the checksum is calculated on receiving each byte, regardless if this byte is a data byte or the frame checksum. for example, when receiving a frame with 4 data bytes, the lincs mmr contains the expected frame checksum once the fourth data byte is received. lincs should contain 0x00 after receiving a correct checksum. ? linlow is a 19-bit counter clocked at 10 mhz to wake up the lin nodes on the bus. the lin bus is forced low as long as the linlow mmr is greater than 0. for example, linlow = 0x234 generates an 11-bit break at 20 kb. ? linwu is a 19-bit counter clocked by the low power oscillator. it is used in slee p mode to specify the length of the low signal that wakes up the device via lin. for example, linwu = 0x13 ignores any breaks of less than 150 s, and the aduc7039 remains asleep.
aduc7039 rev. b | page 84 of 92 lincon register name: lincon address: 0xffff0700 default value: 0x0000 access: read/write function: this 16-bit mmr controls the lin peripheral. lincs register name: lincs address: 0xffff0704 default value: 0xff access: read/write function: 8-bit checksum register. linbr register name: linbr address: 0xffff0708 default value: 0x00fa0 access: read/write function: 19-bit baud rate register. linbk register name: linbk address: 0xffff070c default value: 0x0000157c access: read/write function: 19-bit break timer register. linsta register name: linsta address: 0xffff0710 default value: 0x0100 access: read only function: 16-bit status register. lindat register name: lindat address: 0xffff0714 default value: 0x00 access: read/write function: 8-bit data register. linlow register name: linlow address: 0xffff0718 default value: 0x00000 access: read/write function: 19-bit register; generates a lin break to wake up other lin peripherals on the bus. linwu register name: linwu address: 0xffff071c default value: 0x00013 access: read/write function: 19-bit register; specify the length of a break waking up the device. there are seven sources of interrupt; five of them are maskable in the lincon mmr: ? lin wake-up ? data received ? transmit readymaskable ? transmit completemaskable ? collision detectedmaskable ? break symbolmaskable ? maximum negative edges within a frame errormaskable
aduc7039 rev. b | page 85 of 92 table 61. lincon mmr bit designations bits description 15 to 13 reserved. 12 lin bypass bit. this bit is set to 1 by user code to take control of the lin transceiver alone, for lin conformance test. this bit is cleared to 0 by user code to operate in normal mode. 11 lin enable bit. this bit is set to 1 by user code to enable the lin interface. this bit is cleared to 0 by user code to disa ble the lin interface or to reset the interface. 10 uart enable bit. this bit is set by user code to allow transmission without receiving the frame header, for test purposes. this bit is cleared by user co de for normal mode operation. 9 timing of sync symbol, bit 0 (not require in a single slave system). ensure that if a second break is transmitted it is recognized as such and not timed as part of the sync symbol. if the start symbol is more than the number of clock ticks dictated by this bit, the device assumes it is now receiving a break and continue s to count the low cycle to see if the break meets the minimu m time required for a break as defined in the linbk mmr. set by the user. the first bit of the sync symb ol must be less than 750 core clocks (73 s). this bit is cleared by the user to disable this functionality. 8 send checksum. this bit is set by the user to transmit th e checksum automatically. this bit must be set after the last data byte to transmit w hat is written in lindat and after the transmit ready bit is set. this bit is cleared automatically by hardware when the checksum is sent. 7 checksum calculation. this bit is set by the user to calculate auto matically a classic checksum (pid excluded). this bit is cleared by the user to calcul ate an enhanced checksum (pid included). modifying the value of this bit during communication, fo r example after receiving a pid, resets the checksum. 6 collision detect and transmit complete interrupt mask. this bit is set by the user to disable the colli sion detect and transmit complete interrupt. this bit is cleared by the user to enable the collision detect and transmit complete interrupt. when the interrupt is enabled, all occurrences of collision detected causes an interrupt to occur and the collision status bit to be asserted, regardless of the state of the transmit finished bit. when masking is enabled, once the transmit is finished, asserted occurrences of collision detected are masked and do no t cause an interrupt to occur or the collision detected status bit to be set. even if this masking bit ha s been set by the user if transmit finished has not been asserted by the device, coll isions cause an interrupt to occur and the collision detected status bit to be set. 5 negative edge maximum error interrupt mask. this bit is set by the user to disable the negative edge maximum error interrupt. this bit is cleared by the user to enable the negative edge maximum error interrupt. an interrupt is generated if the negative edge counter counts more than 57 edges in a frame. 4 collision detect interrupt mask. this bit is set by the user to disable the collision detect interrupt. this bit is cleared by the user to en able the collision detect interrupt. 3 break received interrupt mask. this bit is set by the user to disabl e the break symbol receive interrupt. this bit is cleared by the user to enable the break symbol receive interrupt. 2 transmit complete interrupt mask. this bit is set by the user to disa ble the transmit complete interrupt. this bit is cleared by the user to en able the transmit complete interrupt. 1 transmit ready interrupt mask. this bit is set by the user to disable the transmit re ady interrupt. set automatica lly when lincon[8] is set. this bit is cleared by the user to enable the transmit ready interrupt. 0 receive/transmit mode. this bit is set by user code to trans mit data bytes after decoding the pid. this bit is cleared automatically when a break symbol is received.
aduc7039 rev. b | page 86 of 92 table 62. linsta mmr bit designations bits description 15 to 11 reserved. 10 lin wake-up interrupt. this bit is set if lin woke up the aduc7039. the wake-up fu nctionality (linwu mmr) is only used when powcon[3] = 0. this bit is cleared automatically by a read of the linsta mmr. 9 break time maximum. this bit is 0 if the first break symbol after enabling the lin interface has ended before maximum count reached. this bit is 1 if the first break symbol after enabling the lin interface has ended after maximum count reached. this bit is cleared automatically by hardware when reading linsta mmr. this bit is only valid on the first break symbol after enabling the lin peripheral via lincon[11]. 8 pid parity error. this bit is set automatically by hardware if the current byte in the lindat register does not correctly match the parity scheme for a pid as described in the lin 2.1 specifications. this bit is cleared by hardware if the cu rrent byte in the lindat register correc tly matches the parity scheme for a pid. it is left to the user to determine when a pid is actually in the data register. the parity check is done whether a pid or data byte is in the lindat mmr. 7 checksum match. this bit is only valid when linsta[0] = 1. this bit is set automatically if the value in li ncs does not match the received data in lindat. this bit is cleared on a read of the linsta mmr or when lindat and lincs match while linsta[0] = 1. 6 frame error. this bit is 0 if there is no frame error. it is cleared automatically by a read of linsta. this bit is 1 if a frame error has occurred during recept ion of a data byte, that is, a valid stop was not detected. 5 negative edge maximum error interrupt (maskable). this bit is 0 if the number of negative edges allowed in a frame is not surpassed. this bit is 1 if the number of negative edges is 57 or more. this bit is cleared automatically by hardware when reading linsta mmr. 4 lin collision detect interrupt (maskable). this bit is set automatically by hardware if the device has sto pped transmission due to a collision on the bus. this bit is not set if the collision detect and transmit complete interrupt is enable d (lincon[6] = 0) and the trans mit complete interrupt bit is s et (linsta[2] = 1). this bit is cleared automatically by hardware when reading linsta mmr. 3 break receive interrupt (maskable). this bit is 0 if no valid break symbol has been received. this bit is 1 if a low time of 11 nominal bits is detected on the lin bus. this bit is cleared automatically on reading the lin sta mmr. 2 transmit complete interrupt (maskable). this bit is 0 if data is still in the lindat register. this bit is 1 when all data is transmitted. it remains set to 1 until the lin receives a break symbol. it is cleared automatica lly in receive mode. 1 transmit ready interrupt (maskable). this bit is 0 if the previous data written in the lindat mmr is still in the lindat and has no t being shifted to the transmit register. writing data to the lindat mmr while the transmit ready bit is 0 overwrites the previous byte to be transmitted. this bit is 1 if the previous data written in th e lindat mmr is now in the transmit register. 0 receive ready interrupt. this bit is 0 if there is no new data to read in the lindat mmr. this bit is 1 if there is new data to read in the lindat mmr. reading the lind at mmr clears this bit.
aduc7039 rev. b | page 87 of 92 part identification for traceability, part identification is available at power-up. information such as manufacturing lot id, silicon mask revision, and kernel revision are available in the internal arm register at power-up (r4 to r6), as described in table 64 and table 65 . for full traceability, r4, r5, r6 and part numbers need to be recorded. the assembly lot id stored in r6 is part of the branding on the package as shown table 63 . for example, for an assembly lot id of 1675904.1, r6 contains 0x00199280. the part number is contained in the mmr feeadr at power-up. table 63. branding example line lfcsp line 1 aduc7039 line 2 bcp6z line 3 b60 #date code line 4 1675904.1 table 64. r4 bit designations at power-up bit description 31 to 27 wafer number. the five bits read from this location give th e wafer number (1 to 24) from the wafer fabrication lot id (from which this device originated). when used in conjunctio n with r4[26:0], it provides individual wafer traceability. 26 to 22 wafer lot fabrication plant. the five bits read from this location reflect the ma nufacturing plant associated with this wafer lot. when it is used in conjunction with r4[21:0], it provides wafer lot traceability. 21 to 16 wafer lot fabrication id. the six bits read from this location form part of the wa fer lot fabrication id, and when used in conjunction with r4[26:22] and r4[15:0], the bits provide wafer lot traceability. 15 to 0 wafer lot fabrication id. these 16 lsbs hold a 16-bit number to be interpreted as the wafer fabrication lot id number. when used in conjunction with the value in r5, that is, the manufacturing lot id, this number is a unique identifier for the part. table 65. r5 bit designations at power-up bit description 31 to 28 silicon mask revision id. the 4 bits read from this nibble refl ect the silicon mask id number. specifically, the hex value in this nibble should be decoded as the lower hex nibble in the hex numbers reflecting the ascii characters in the range of a to o. for example, bits[19:16] = 0001 = 0x1; therefore, this value should be in terpreted as 41 which is ascii character a corresponding to silicon mask revision a. bits[19:16] = 1011 = 0xb; therefore the number is interpreted as 4b which is ascii character k corresponding to silicon mask revision k. the allowable range for this value is 1 to 15 which is inte rpreted as 41 to 4f or ascii character a to character o. 27 to 20 kernel revision id. this byte contains the hex number, which should be interpreted as an ascii character indicating the revision of the kernel firmware embedded in the on-chip fl ash/ee memory. for example, reading 0x41 from this byte should be interpreted as a indicating a revision a kernel is on-chip. 19 to 16 reserved. for prerelease samples, these bits refer to the kernel minor revision number of the device. 15 to 0 part id. these 16 lsbs hold a 16-bit number that are interpre ted as the part id number. when used in conjunction with the value in r4 (that is, the manufacturing lot id) this number is a unique identifier for the part.
aduc7039 rev. b | page 88 of 92 system identification feeadr name: feeadr address: 0xffff0e10 default value: 0xf009 access: read/write function: this 16-bit register dictates the address upon which any flash/ee command executed via feecon acts. note: this mmr is also used to identify aduc703x family member and prerelease silicon revision. table 66. feeadr system identi fication mmr bit designations bit description 15 to 4 reserved 3 to 0 aduc703x family id 0x0 = aduc7030 0x2 = aduc7032 0x3 = aduc7033 0x4 = aduc7034 0x6 = aduc7036 0x9 = aduc7039 others = reserved for future use
aduc7039 rev. b | page 89 of 92 recommended schematic this schematic contains external components that are recommended for proper operation of the aduc7039. 29 27 12 13 19 29 1 11 14 15 20 30 31 agnd agnd agnd dgnd io_vss vss reg_dvdd 18 reg_dvdd lin jtag adaptor reset reg_dvdd 2.2f 10f 0.1f 0.1f 220pf 17 reg_avdd 0.47f gnd_sw 16 reg_avdd 0.1f iin? 10 9 iin? reg_avdd iin+ iin+ shunt vbat vdd 10 ? 20? vbat 2 tdo 3 tck 4 tms 5 tdi 6 ntrst 7 rtck aduc7039 ecu master pesd1lin 08463-030 figure 33. recommended schematic
aduc7039 rev. b | page 90 of 92 outline dimensions 061609-a 1 0.50 bsc bottom view top view pin 1 indicator 32 9 16 17 24 25 8 exposed pad p i n 1 i n d i c a t o r seating plane 0.05 max 0.02 nom 0.15 ref coplanarity 0.08 0.30 0.25 0.18 6.10 6.00 sq 5.90 1.00 0.95 0.90 for proper connection of the exposed pad, refer to the pin configuration and function descriptions section of this data sheet. 0.65 0.60 0.55 0.20 min 3.90 3.80 sq 3.70 compliant to jedec standards mo-220-vjjd. figure 34 .32-lead lead frame chip scale package [lfcsp_vq] 6 mm 6 mm body, very thin quad (cp-32-15) dimensions shown in millimeters ordering guide model 1 temperature range flash/ram package description package option ADUC7039BCP6Z ?40c to 115c 64k/4k 32-lead fram e chip scale package [lfcsp_vq] cp-32-15 ADUC7039BCP6Z-rl ?40c to 115c 64k/4k 32-lead fr ame chip scale package [lfcsp_vq] cp-32-15 eval-aduc7039qspz evaluation board 1 z = rohs compliant part.
aduc7039 rev. b | page 91 of 92 notes
aduc7039 rev. b | page 92 of 92 notes ?2010 analog devices, inc. all rights reserved. trademarks and registered trademarks are the prop erty of their respective owners. d08463-0-8/10(b)


▲Up To Search▲   

 
Price & Availability of ADUC7039BCP6Z

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X